Fix for images without metadata crashing
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 7 Feb 2019 08:33:43 +0000 (09:33 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 7 Feb 2019 08:34:01 +0000 (09:34 +0100)
source/blender/imbuf/intern/metadata.c

index 01b9abe6a386c57283c16de2f5aabe4e38d92b1e..07e77aee9d47a5b1acaadd4fa77c16da3b7a9f27 100644 (file)
@@ -105,6 +105,9 @@ void IMB_metadata_set_field(struct IDProperty *metadata, const char *key, const
 
 void IMB_metadata_foreach(struct ImBuf *ibuf, IMBMetadataForeachCb callback, void *userdata)
 {
+       if (ibuf->metadata == NULL) {
+               return;
+       }
        for (IDProperty *prop = ibuf->metadata->data.group.first; prop != NULL; prop = prop->next) {
                callback(prop->name, IDP_String(prop), userdata);
        }