Don't crash when attempting to save a bitmap with no data. This can happen when out of memory.

svn path=/trunk/netsurf/; revision=4332
This commit is contained in:
James Bursa 2008-06-14 23:13:19 +00:00
parent 43fe533340
commit 337a2004cc
1 changed files with 6 additions and 1 deletions

View File

@ -1057,7 +1057,12 @@ void bitmap_save_file(struct bitmap *bitmap)
os_error *error; os_error *error;
struct bitmap_compressed_header *header; struct bitmap_compressed_header *header;
assert(bitmap && (bitmap->compressed || bitmap->sprite_area)); assert(bitmap);
if (!bitmap->compressed && !bitmap->sprite_area) {
LOG(("bitmap has no data"));
return;
}
/* unmodified bitmaps will still have their file available */ /* unmodified bitmaps will still have their file available */
if ((!(bitmap->state & BITMAP_MODIFIED)) && bitmap->filename[0]) { if ((!(bitmap->state & BITMAP_MODIFIED)) && bitmap->filename[0]) {