[x3d-public] possible patch to X3DOM, src/nodes/Core/X3DNode.js

John Carlson yottzumm at gmail.com
Fri Nov 20 08:51:37 PST 2020


This patch follows Andreas' work on PROTOs, and may conflict with it.  This
is likely a fairly harmless patch.  This patch may not be needed.   Let me
know when the patch is applied, or if it isn't, so I can remove my backups.

John

diff --git a/src/nodes/Core/X3DNode.js b/src/nodes/Core/X3DNode.js
index b3658510..408df60b 100644
--- a/src/nodes/Core/X3DNode.js
+++ b/src/nodes/Core/X3DNode.js
@@ -76,7 +76,7 @@ x3dom.registerNodeType(

             addChild : function ( node, containerFieldName )
             {
-                if ( "isProtoInstance" in node )
+                if ( node !== null && "isProtoInstance" in node )
                 {
                     this.addChild( node.typeNode, containerFieldName );
                     if ( node.helperNodes.length > 0 )
@@ -125,19 +125,19 @@ x3dom.registerNodeType(
                     {
                         node._parentNodes.push( this );
                         this._childNodes.push( node );
-                        if ( !( "isProtoInstance" in this ) )
+                        if ( this !== null && !( "isProtoInstance" in this
) )
                         {
                             node.parentAdded( this );
                         }
                         return true;
                     }
-                    else if ( "isProtoInstance" in this )
+                    else if ( this !== null && "isProtoInstance" in this )
                     {
                         //child is not a field value, parent is protobody
                         //so child is "root node" of protobody
                         //and constitutes its nodes
                         //transfer nodes directly
-                        if ( "isProtoInstance" in node )
+                        if ( node !== null && "isProtoInstance" in node )
                         {
                             this.nodes.concat( node.nodes );
                         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20201120/4cf18470/attachment.html>


More information about the x3d-public mailing list