At least don't crash when no project is opened

This commit is contained in:
Simon Lübeß
2026-08-02 12:34:26 +02:00
parent 85b3fd5bc9
commit 9b14cdddb9
2 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ namespace GlitchyEditor.Assets;
class AssetHierarchy
{
FileSystemWatcher fsw ~ {
_.StopRaisingEvents();
_?.StopRaisingEvents();
delete _;
};
@@ -302,7 +302,7 @@ namespace GlitchyEditor.EditWindows
}
}
private bool CanNavigateUp => _currentDirectoryNode.Parent != _manager.AssetHierarchy.RootNode;
private bool CanNavigateUp => _currentDirectoryNode?.Parent != _manager.AssetHierarchy.RootNode;
private void NavigateUp()
{
@@ -1528,11 +1528,14 @@ namespace GlitchyEditor.EditWindows
TreeNode<AssetNode> walker = _currentDirectoryNode;
repeat
if (walker != null)
{
path.AddFront(walker);
walker = walker.Parent;
} while (walker != _manager.AssetHierarchy.RootNode);
repeat
{
path.AddFront(walker);
walker = walker.Parent;
} while (walker != _manager.AssetHierarchy.RootNode);
}
ImGui.SameLine();
@@ -1601,7 +1604,7 @@ namespace GlitchyEditor.EditWindows
ImGui.SameLine();
}
if (_currentDirectoryNode.Children.Any((c) => c->IsDirectory))
if (_currentDirectoryNode?.Children.Any((c) => c->IsDirectory) ?? false)
{
ImGui.Button("...");