diff options
author | Ton Roosendaal <ton@blender.org> | 2007-03-29 16:42:30 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-03-29 16:42:30 +0400 |
commit | 054c471a043698864a5f8aa03445e0b64a221d65 (patch) | |
tree | e0eed45d0cd1a2faea63babb32490cc17a3e4df5 /source/blender | |
parent | bb5ca9afdbbb0dfc240530f777f474766d82fcf7 (diff) |
Bugfix #6419
When adding images, there was no check if image file was a directory.
Result was an Image without name even. Fixed!
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 152f898d174..822f99c0d9b 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -318,11 +318,19 @@ Image *BKE_add_image_file(const char *name) const char *libname; 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_convertstringcode(str, G.sce, G.scene->r.cfra); + /* exists? */ file= open(str, O_BINARY|O_RDONLY); - if(file== -1) return 0; + if(file== -1) return NULL; close(file); /* first search an identical image */ |