diff --git a/Source/AppScaffolding/AppScaffolding.csproj b/Source/AppScaffolding/AppScaffolding.csproj index 27f04f60..16e47668 100644 --- a/Source/AppScaffolding/AppScaffolding.csproj +++ b/Source/AppScaffolding/AppScaffolding.csproj @@ -2,7 +2,7 @@ net7.0 - 9.2.1.1 + 9.2.2.1 diff --git a/Source/LibationAvalonia/ViewModels/GridEntry.cs b/Source/LibationAvalonia/ViewModels/GridEntry.cs index b20f12cd..0baad921 100644 --- a/Source/LibationAvalonia/ViewModels/GridEntry.cs +++ b/Source/LibationAvalonia/ViewModels/GridEntry.cs @@ -130,8 +130,17 @@ namespace LibationAvalonia.ViewModels } private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e) - { - if (e.Definition.PictureId == Book.PictureId) + { + // state validation + if (e is null || + e.Definition.PictureId is null || + Book?.PictureId is null || + e.Picture is null || + e.Picture.Length == 0) + return; + + // logic validation + if (e.Definition.PictureId == Book.PictureId) { using var ms = new System.IO.MemoryStream(e.Picture); Cover = new Avalonia.Media.Imaging.Bitmap(ms); diff --git a/Source/LibationWinForms/GridView/GridEntry.cs b/Source/LibationWinForms/GridView/GridEntry.cs index 43aff6fa..4923b86b 100644 --- a/Source/LibationWinForms/GridView/GridEntry.cs +++ b/Source/LibationWinForms/GridView/GridEntry.cs @@ -140,7 +140,16 @@ namespace LibationWinForms.GridView private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e) { - if (e.Definition.PictureId == Book.PictureId) + // state validation + if (e is null || + e.Definition.PictureId is null || + Book?.PictureId is null || + e.Picture is null || + e.Picture.Length == 0) + return; + + // logic validation + if (e.Definition.PictureId == Book.PictureId) { Cover = ImageReader.ToImage(e.Picture); PictureStorage.PictureCached -= PictureStorage_PictureCached; diff --git a/Source/LibationWinForms/LibationWinForms.csproj b/Source/LibationWinForms/LibationWinForms.csproj index 6f70cb52..7c025399 100644 --- a/Source/LibationWinForms/LibationWinForms.csproj +++ b/Source/LibationWinForms/LibationWinForms.csproj @@ -64,16 +64,6 @@ SettingsDialog.cs - - - Form1.cs - - - - - Form1.cs - -