Skip to content

Commit

Permalink
Avoid crash on startup with markdown code blocks (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchLeaders committed Aug 31, 2024
1 parent 1b5c12f commit 5fe4253
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/Tkmm/Helpers/PageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public partial class PageManager : ObservableObject
[ObservableProperty]
private PageModel? _current = null;

[ObservableProperty]
private Page _default;

private readonly Dictionary<Page, (int Index, bool IsFooter)> _lookup = [];
public ObservableCollection<PageModel> Pages { get; } = [];
public ObservableCollection<PageModel> FooterPages { get; } = [];
Expand All @@ -51,7 +54,7 @@ public void Register(Page page, string title, object? content, Symbol icon, stri
});

if (isDefault) {
Focus(page);
Default = page;
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/Tkmm/Models/SplashScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public async Task RunTasks(CancellationToken cancellationToken)

await Task.WhenAll(tasks);

PageModel? store = PageManager.Shared.Current;
PageManager.Shared.Focus(Page.Settings);
PageManager.Shared.Current = store;
PageManager.Shared.Focus(PageManager.Shared.Default);
}
}

0 comments on commit 5fe4253

Please sign in to comment.