From 2bbfaa74193e0458f47914b1605076ef27ebe1f7 Mon Sep 17 00:00:00 2001 From: Matt Lacey Date: Thu, 8 Jan 2026 10:37:20 +0000 Subject: [PATCH 1/2] Fix NRE when click "Data" with no document open --- XamlStudio/Views/DataSources.xaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/XamlStudio/Views/DataSources.xaml.cs b/XamlStudio/Views/DataSources.xaml.cs index 477f6bf..1846e32 100644 --- a/XamlStudio/Views/DataSources.xaml.cs +++ b/XamlStudio/Views/DataSources.xaml.cs @@ -85,6 +85,11 @@ private void DataSources_Loaded(object sender, RoutedEventArgs e) public void Receive(ActiveDocumentViewModelChangedMessage message) { + if (message.NewDocVM is null) + { + return; + } + // Update are shadow-copy based on MainViewModel _activeDocument = message.NewDocVM.Document; ActiveDataContext = _activeDocument.DataContext; From 88d038e42af5b1d4aafd582e77fc6dd2cb2472c6 Mon Sep 17 00:00:00 2001 From: Matt Lacey Date: Thu, 8 Jan 2026 10:37:41 +0000 Subject: [PATCH 2/2] Avoid NRE when click "Properties" with no document open --- XamlStudio/Views/Properties.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XamlStudio/Views/Properties.xaml.cs b/XamlStudio/Views/Properties.xaml.cs index af8d413..583c804 100644 --- a/XamlStudio/Views/Properties.xaml.cs +++ b/XamlStudio/Views/Properties.xaml.cs @@ -51,7 +51,7 @@ private void Properties_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) WeakReferenceMessenger.Default.RegisterAll(this); // Check if there's a render and initialize our existing state - if (MainViewModel.ActiveDocumentViewModel.HasCompiled) + if (MainViewModel.ActiveDocumentViewModel?.HasCompiled ?? false) { Receive(new XamlRenderedMessage(MainViewModel.ActiveDocumentViewModel.Result)); }