diff --git a/riscos/bitmap.c b/riscos/bitmap.c index 4d8423cdb..613b93c8f 100644 --- a/riscos/bitmap.c +++ b/riscos/bitmap.c @@ -224,9 +224,26 @@ struct bitmap *bitmap_create(int width, int height, unsigned int state) struct bitmap *bitmap_create_file(char *file) { struct bitmap *bitmap; + char *r; + fileswitch_object_type obj_type; + os_error *error; + if (file[0] == '\0') return NULL; + /* check the file exists */ + sprintf(bitmap_unixname, "%s/%s", TEMP_FILENAME_PREFIX, file); + r = __riscosify(bitmap_unixname, 0, __RISCOSIFY_NO_SUFFIX, + bitmap_filename, 256, 0); + if (r == 0) { + LOG(("__riscosify failed")); + return NULL; + } + error = xosfile_read_stamped_no_path(bitmap_filename, + &obj_type, 0, 0, 0, 0, 0); + if ((error) || (obj_type != fileswitch_IS_FILE)) + return NULL; + if (!filename_claim(file)) return NULL; bitmap = calloc(1, sizeof(struct bitmap));