Fix #23188: libpng error: Image width or height is zero in IHDR.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 12 Aug 2010 15:15:02 +0000 (15:15 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 12 Aug 2010 15:15:02 +0000 (15:15 +0000)
The file thumbnail generator would write 0x0 size png's to the .thumbnails/fail
folder. However libpng throws an error when doing this. Instead we now write 1x1
png's, which nautilus seems to be doing as well. The content shouldn't matter
anyway since we won't use it.

source/blender/imbuf/intern/thumbs.c

index a2880b9885648a5d59718655f8e46b32eafb18d8..f3415d44ecb24adbf923b4b8accc567ae29978bc 100644 (file)
@@ -264,7 +264,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
                        tsize = 256;
                        break;
                case THB_FAIL:
-                       tsize = 0;
+                       tsize = 1;
                        break;
                default:
                        return 0; /* unknown size */
@@ -280,7 +280,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
                        return NULL;
                }
                if (size == THB_FAIL) {
-                       img = IMB_allocImBuf(0,0,32, IB_rect | IB_metadata, 0);
+                       img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata, 0);
                        if (!img) return 0;
                } else {
                        if (THB_SOURCE_IMAGE == source || THB_SOURCE_BLEND == source) {