When an image content cannot be converted prevent export as sprite

If an image is not converted, for example it is a CMYK jpeg this
prevents a crash if trying to export the image as a RISC OS sprite.
This commit is contained in:
Dave Higton 2015-10-31 15:49:34 +00:00 committed by Vincent Sanders
parent b1533a7f76
commit f2e56834be
2 changed files with 8 additions and 0 deletions

View File

@ -3222,6 +3222,8 @@ fr.all.DirectoryError:répertoire '%s' existe déjà
it.all.DirectoryError:La directory '%s' è già esistente
nl.all.DirectoryError:map '%s' bestaat reeds
en.ro.SprIsNull:Unable to convert image to sprite
# Error messages for Amiga version only
en.ami.CompError:Unable to open
de.ami.CompError:Nicht zu öffnen

View File

@ -43,6 +43,7 @@
#include "utils/filename.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/messages.h"
#include "desktop/plotters.h"
#include "content/content.h"
#include "image/bitmap.h"
@ -272,6 +273,11 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
struct bitmap *bitmap = (struct bitmap *) vbitmap;
os_error *error;
if (bitmap == NULL) {
warn_user("SaveError", messages_get("SprIsNull"));
return false;
}
if (!bitmap->sprite_area) {
riscos_bitmap_get_buffer(bitmap);
}