Check file exists in bitmap_create_file(). Fixes empty local history when Scrap is wiped.

svn path=/trunk/netsurf/; revision=4335
This commit is contained in:
James Bursa 2008-06-15 00:27:22 +00:00
parent 884b93acaa
commit d860d93de2

View File

@ -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));