浏览代码

Tentative fix for shadergraph editor crash on launch

Clement Espeute 1 年之前
父节点
当前提交
aef83db6cf
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      hide/view/shadereditor/ShaderEditor.hx

+ 8 - 1
hide/view/shadereditor/ShaderEditor.hx

@@ -1171,8 +1171,15 @@ class ShaderEditor extends hide.view.Graph {
 	}
 
 	var boxToPreview : Map<Box, Preview>;
-
+	var timeout = 0;
 	function onMiniPreviewReady() {
+		if (previewsScene.s2d == null) {
+			timeout ++;
+			if (timeout > 10)
+				throw "Couldn't initialize background previews";
+			haxe.Timer.delay(() -> onMiniPreviewReady, 100);
+			return;
+		}
 		var bg = new h2d.Flow(previewsScene.s2d);
 		bg.fillHeight = true;
 		bg.fillWidth = true;