Browse Source

LightProbe: fix null access

lviguier 6 tháng trước cách đây
mục cha
commit
e17045d1c2
2 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 1 1
      hide/comp/SceneEditor.hx
  2. 3 1
      hrt/prefab/vlm/LightProbe.hx

+ 1 - 1
hide/comp/SceneEditor.hx

@@ -2236,7 +2236,7 @@ class SceneEditor {
 		}
 
 		var wasSet = false;
-		if( @:privateAccess renderPropsRoot.refInstance != null ) {
+		if( @:privateAccess renderPropsRoot?.refInstance != null ) {
 			var renderProps = @:privateAccess renderPropsRoot.refInstance.getOpt(hrt.prefab.RenderProps, true);
 			if( renderProps != null ) {
 				renderProps.applyProps(scene.s3d.renderer);

+ 3 - 1
hrt/prefab/vlm/LightProbe.hx

@@ -135,7 +135,7 @@ class LightProbeObject extends h3d.scene.Mesh {
 
 	override function onRemove() {
 		super.onRemove();
-		env.dispose();
+		env?.dispose();
 	}
 
 	override function emit( ctx : h3d.scene.RenderContext ) {
@@ -528,6 +528,8 @@ class LightProbe extends Object3D {
 	}
 
 	override function setSelected(b : Bool ) {
+		if (local3d == null)
+			return true;
 		var w = local3d.find( o -> o.name == "wire_select" ? o : null);
 		if( w != null )
 			w.visible = b;