Procházet zdrojové kódy

Emitter: fix null access when spawning emitter outside of scene

trethaller před 6 roky
rodič
revize
5f778d5dd4
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      hrt/prefab/fx/Emitter.hx

+ 6 - 1
hrt/prefab/fx/Emitter.hx

@@ -809,7 +809,12 @@ class Emitter extends Object3D {
 		emitterObj.animationRepeat = getParamVal("animationRepeat");
 		emitterObj.animationLoop = getParamVal("animationLoop");
 
-		emitterObj.createMeshBatch(@:privateAccess ctx.local3d.getScene().renderer.ctx.time);
+		var startTime = 0.0;
+		var scene = ctx.local3d.getScene();
+		if(scene != null)
+			startTime = @:privateAccess scene.renderer.ctx.time;
+
+		emitterObj.createMeshBatch(startTime);
 
 		#if editor
 		if(propName == null || ["emitShape", "emitAngle", "emitRad1", "emitRad2"].indexOf(propName) >= 0)