diff --git a/MatterControlLib/ApplicationView/Config/ThumbnailsConfig.cs b/MatterControlLib/ApplicationView/Config/ThumbnailsConfig.cs index 9885bd4c1..2ca041bc3 100644 --- a/MatterControlLib/ApplicationView/Config/ThumbnailsConfig.cs +++ b/MatterControlLib/ApplicationView/Config/ThumbnailsConfig.cs @@ -92,17 +92,19 @@ namespace MatterHackers.MatterControl var expectedCachePath = this.CachePath(libraryItem, width, height); ImageBuffer cachedItem = LoadImage(expectedCachePath); - if(cachedItem != null) + if (cachedItem != null + && cachedItem.Width > 0 && cachedItem.Height > 0) { cachedItem.SetRecieveBlender(new BlenderPreMultBGRA()); return cachedItem; } // if we don't find it see if it is in the cache at a bigger size - foreach(var cacheSize in cacheSizes.Where(s => s > width)) + foreach (var cacheSize in cacheSizes.Where(s => s > width)) { cachedItem = LoadImage(this.CachePath(libraryItem, cacheSize, cacheSize)); - if(cachedItem != null) + if (cachedItem != null + && cachedItem.Width > 0 && cachedItem.Height > 0) { cachedItem = cachedItem.CreateScaledImage(width, height); cachedItem.SetRecieveBlender(new BlenderPreMultBGRA()); diff --git a/MatterControlLib/Library/Providers/LibraryConfig.cs b/MatterControlLib/Library/Providers/LibraryConfig.cs index a66b0ab7c..4ca18b939 100644 --- a/MatterControlLib/Library/Providers/LibraryConfig.cs +++ b/MatterControlLib/Library/Providers/LibraryConfig.cs @@ -201,6 +201,11 @@ namespace MatterHackers.MatterControl.Library { if (icon != null) { + if (icon.Width == 0) + { + return; + } + icon = await Task.Run(() => this.EnsureCorrectThumbnailSizing(icon, thumbWidth, thumbHeight)); thumbnailListener?.Invoke(icon); }