Просмотр исходного кода

fix CollisonShape changing shape cause crash when not in a tree

yakun.zhang 6 лет назад
Родитель
Сommit
2206c5e9c0
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      scene/3d/collision_shape.cpp

+ 1 - 1
scene/3d/collision_shape.cpp

@@ -228,7 +228,7 @@ void CollisionShape::_update_debug_shape() {
 }
 }
 
 
 void CollisionShape::_shape_changed() {
 void CollisionShape::_shape_changed() {
-	if (get_tree()->is_debugging_collisions_hint() && !debug_shape_dirty) {
+	if (is_inside_tree() && get_tree()->is_debugging_collisions_hint() && !debug_shape_dirty) {
 		debug_shape_dirty = true;
 		debug_shape_dirty = true;
 		call_deferred("_update_debug_shape");
 		call_deferred("_update_debug_shape");
 	}
 	}