From f3b019e4db0ddc9eda85710285419a778aedd540 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 8 Oct 2021 16:56:56 +0200 Subject: [PATCH] Add additional error prevention for AssetReferencesGraphWindow loading task --- .../Windows/AssetReferencesGraphWindow.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Source/Editor/Windows/AssetReferencesGraphWindow.cs b/Source/Editor/Windows/AssetReferencesGraphWindow.cs index 7bc5559bd..0cd6c4a2b 100644 --- a/Source/Editor/Windows/AssetReferencesGraphWindow.cs +++ b/Source/Editor/Windows/AssetReferencesGraphWindow.cs @@ -216,7 +216,7 @@ namespace FlaxEditor.Windows asset = FlaxEngine.Content.LoadAsync(assetId); if (asset == null || asset.IsVirtual) return; - while (asset && !asset.IsLoaded) + while (asset && !asset.IsLoaded && !asset.LastLoadFailed) { if (_token.IsCancellationRequested) return; @@ -358,13 +358,24 @@ namespace FlaxEditor.Windows _progress = 100.0f; // Update UI - FlaxEngine.Scripting.InvokeOnUpdate(() => _surface.Init(_nodes)); + FlaxEngine.Scripting.InvokeOnUpdate(() => + { + _surface.Init(_nodes); + _loadingLabel.Visible = false; + }); } private void Load() { - LoadInner(); - FlaxEngine.Scripting.InvokeOnUpdate(() => _loadingLabel.Visible = false); + try + { + LoadInner(); + } + catch (Exception ex) + { + Editor.LogWarning(ex); + Close(); + } } ///