فهرست منبع

[ref] Fix editor load of invalid refs

Clément Espeute 4 ماه پیش
والد
کامیت
6c4f0f42fe
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      hrt/prefab/Reference.hx

+ 7 - 1
hrt/prefab/Reference.hx

@@ -91,7 +91,11 @@ class Reference extends Object3D {
 		var otherRef : Reference = cast obj;
 
 		#if editor
-		originalSource = @:privateAccess hxd.res.Loader.currentInstance.load(source).toPrefab().loadData();
+		try {
+			originalSource = @:privateAccess hxd.res.Loader.currentInstance.load(source).toPrefab().loadData();
+		} catch (e) {
+
+		}
 		#end
 
 		// Clone the refInstance from the original prefab on copy
@@ -168,6 +172,8 @@ class Reference extends Object3D {
 		// in the case source has changed since the last load (can happen when creating references manually)
 		if (refInstance?.shared.currentPath != source) {
 			initRefInstance();
+			if (refInstance == null)
+				return;
 			refInstance = refInstance.clone();
 		}
 		#if editor