Various stability improvements for Editor

This commit is contained in:
Wojtek Figat
2023-10-17 22:42:47 +02:00
parent 90427da42f
commit 8d9f4d72f5
6 changed files with 63 additions and 29 deletions

View File

@@ -388,14 +388,16 @@ namespace FlaxEditor.Windows.Assets
protected override void OnShow()
{
// Check if has no asset (but has item linked)
if (_asset == null && _item != null)
var item = _item;
if (_asset == null && item != null)
{
// Load asset
_asset = LoadAsset();
if (_asset == null)
{
Editor.LogError(string.Format("Cannot load asset \'{0}\' ({1})", _item.Path, typeof(T)));
Editor.LogError(string.Format("Cannot load asset \'{0}\' ({1})", item.Path, typeof(T)));
Close();
Editor.ContentDatabase.RefreshFolder(item, false);
return;
}

View File

@@ -521,8 +521,11 @@ namespace FlaxEditor.Windows.Assets
/// <inheritdoc />
protected override void OnClose()
{
// Discard unsaved changes
_properties.DiscardChanges();
if (Asset)
{
// Discard unsaved changes
_properties.DiscardChanges();
}
// Cleanup
_undo.Clear();