Browse Source

fix when removing in remove

Nicolas Cannasse 3 years ago
parent
commit
9f3d48692e
1 changed files with 4 additions and 2 deletions
  1. 4 2
      h2d/Object.hx

+ 4 - 2
h2d/Object.hx

@@ -489,8 +489,10 @@ class Object #if (domkit && !domkit_heaps) implements domkit.Model<h2d.Object> #
 		if( filter != null )
 			filter.unbind(this);
 		var i = children.length - 1;
-		while( i >= 0 )
-			children[i--].onRemove();
+		while( i >= 0 ) {
+			var c = children[i--];
+			if( c != null ) c.onRemove();
+		}
 	}
 
 	/**