mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-26 11:24:57 +03:00
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:
parent
884b93acaa
commit
d860d93de2
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user