diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-05-26 14:45:45 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-05-26 14:46:14 +0300 |
commit | a64cb4185e2a6695d7fe12637fd9b624714fe75e (patch) | |
tree | e60259cd4b42d42d6236b3899c6a8970a36a3214 /source/blender/blenkernel/intern/image.c | |
parent | 8299284389fc4992128a15fff5b8269185933827 (diff) |
Trying to pack image with invalid path crashes
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 7b6e749ea94..f22a519d256 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1017,7 +1017,12 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath) ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image packed file"); BLI_addtail(&ima->packedfiles, imapf); imapf->packedfile = newPackedFile(reports, ima->name, basepath); - BLI_strncpy(imapf->filepath, ima->name, sizeof(imapf->filepath)); + if (imapf->packedfile) { + BLI_strncpy(imapf->filepath, ima->name, sizeof(imapf->filepath)); + } + else { + BLI_freelinkN(&ima->packedfiles, imapf); + } } else { ImageView *iv; @@ -1026,7 +1031,12 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath) BLI_addtail(&ima->packedfiles, imapf); imapf->packedfile = newPackedFile(reports, iv->filepath, basepath); - BLI_strncpy(imapf->filepath, iv->filepath, sizeof(imapf->filepath)); + if (imapf->packedfile) { + BLI_strncpy(imapf->filepath, iv->filepath, sizeof(imapf->filepath)); + } + else { + BLI_freelinkN(&ima->packedfiles, imapf); + } } } } |