Browse Source

Merge pull request #251 from Temechon/patch-10

Bug fix
deltakosh 11 years ago
parent
commit
a93090bfb4
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Babylon/Mesh/babylon.abstractMesh.ts

+ 5 - 2
Babylon/Mesh/babylon.abstractMesh.ts

@@ -743,7 +743,10 @@
 
 
             // Remove from scene
             // Remove from scene
             var index = this.getScene().meshes.indexOf(this);
             var index = this.getScene().meshes.indexOf(this);
-            this.getScene().meshes.splice(index, 1);
+            if (index != -1){
+                // Remove from the scene if mesh found
+                this.getScene().meshes.splice(index, 1);
+            }
 
 
             if (!doNotRecurse) {
             if (!doNotRecurse) {
                 // Particles
                 // Particles
@@ -779,4 +782,4 @@
             }
             }
         }
         }
     }
     }
-}
+}