Skip to content

Commit 9d71f7c

Browse files
committed
fix(frontend): surface directory load failures
1 parent b08fbaf commit 9d71f7c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

MCServerLauncher.WPF/InstanceConsole/View/Pages/FileManagerPage.xaml.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ public async Task LoadChildrenAsync()
197197
catch (Exception ex)
198198
{
199199
Log.Error(ex, "[FileManager] Failed to load tree children for {0}", VirtualPath);
200+
Application.Current.Dispatcher.Invoke(() =>
201+
{
202+
Children.Clear();
203+
Children.Add(new TreeItem(_viewModel) { Name = Lang.Tr["Status_LoadFailed"] });
204+
IsLoaded = true;
205+
});
200206
}
201207
}
202208

@@ -443,7 +449,7 @@ private string GetParentVirtualPath(string virtualPath)
443449

444450
public async Task<IEnumerable<Common.ProtoType.Files.DirectoryEntry.DirectoryInformation>> GetDirectoriesAsync(string virtualPath)
445451
{
446-
if (_daemon == null) return Array.Empty<Common.ProtoType.Files.DirectoryEntry.DirectoryInformation>();
452+
if (_daemon == null) throw new InvalidOperationException("Daemon connection is unavailable.");
447453
var realPath = GetRealPath(virtualPath);
448454
var (directories, _, _) = await _daemon.GetDirectoryInfoAsync(realPath);
449455
return directories;

0 commit comments

Comments
 (0)