forked from bartvdbraak/blender
Bugfix #6419
When adding images, there was no check if image file was a directory. Result was an Image without name even. Fixed!
This commit is contained in:
parent
bb5ca9afdb
commit
054c471a04
@ -318,11 +318,19 @@ Image *BKE_add_image_file(const char *name)
|
|||||||
const char *libname;
|
const char *libname;
|
||||||
char str[FILE_MAX], strtest[FILE_MAX];
|
char str[FILE_MAX], strtest[FILE_MAX];
|
||||||
|
|
||||||
|
/* escape when name is directory */
|
||||||
|
len= strlen(name);
|
||||||
|
if(len) {
|
||||||
|
if(name[len-1]=='/' || name[len-1]=='\\')
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
BLI_strncpy(str, name, sizeof(str));
|
BLI_strncpy(str, name, sizeof(str));
|
||||||
BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
|
BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
|
||||||
|
|
||||||
|
/* exists? */
|
||||||
file= open(str, O_BINARY|O_RDONLY);
|
file= open(str, O_BINARY|O_RDONLY);
|
||||||
if(file== -1) return 0;
|
if(file== -1) return NULL;
|
||||||
close(file);
|
close(file);
|
||||||
|
|
||||||
/* first search an identical image */
|
/* first search an identical image */
|
||||||
|
Loading…
Reference in New Issue
Block a user