浏览代码

Fix `NullReferenceException` in `DateTimeInput` visibility toggle

- Added null checks for `_partStackPanel` to prevent runtime errors.
Ruben 3 天之前
父节点
当前提交
1c404e31c0
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/PicView.Avalonia/CustomControls/DateTimeInput.axaml.cs

+ 2 - 2
src/PicView.Avalonia/CustomControls/DateTimeInput.axaml.cs

@@ -99,11 +99,11 @@ public class DateTimeInput : TemplatedControl
         {
             if (vm.PicViewer?.FileInfo.Value?.Exists == true)
             {
-                _partStackPanel.IsVisible = true;
+                _partStackPanel?.IsVisible = true;
             }
             else
             {
-                _partStackPanel.IsVisible = false;
+                _partStackPanel?.IsVisible = false;
             }
         }
         // Set a flag to indicate that the update is coming from the property,