[Bf-blender-cvs] [bfe7fdedfc3] master: Fix T64867: crash when changin image source to Movie

Philipp Oeser noreply at git.blender.org
Tue May 21 09:37:02 CEST 2019


Commit: bfe7fdedfc3b67fcdfcc962fee7fbe59a9c34458
Author: Philipp Oeser
Date:   Mon May 20 13:43:25 2019 +0200
Branches: master
https://developer.blender.org/rBbfe7fdedfc3b67fcdfcc962fee7fbe59a9c34458

Fix T64867: crash when changin image source to Movie

thx @Gvgeo for adding the python/RNA case as well.

Reviewers: brecht

Maniphest Tasks: T64867

Differential Revision: https://developer.blender.org/D4902

===================================================================

M	source/blender/editors/space_image/image_buttons.c
M	source/blender/makesrna/intern/rna_image.c

===================================================================

diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 8fada528f48..b32f5ef6d9e 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -1254,7 +1254,10 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i
     int duration = 0;
 
     if (ima->source == IMA_SRC_MOVIE && BKE_image_has_anim(ima)) {
-      duration = IMB_anim_get_duration(((ImageAnim *)ima->anims.first)->anim, IMB_TC_RECORD_RUN);
+      struct anim *anim = ((ImageAnim *)ima->anims.first)->anim;
+      if (anim) {
+        duration = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN);
+      }
     }
 
     if (duration > 0) {
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 11abe968470..7f2eccf421e 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -332,7 +332,10 @@ static int rna_Image_frame_duration_get(PointerRNA *ptr)
   int duration = 1;
 
   if (BKE_image_has_anim(ima)) {
-    duration = IMB_anim_get_duration(((ImageAnim *)ima->anims.first)->anim, IMB_TC_RECORD_RUN);
+    struct anim *anim = ((ImageAnim *)ima->anims.first)->anim;
+    if (anim) {
+      duration = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN);
+    }
   }
   else {
     /* acquire ensures ima->anim is set, if possible! */



More information about the Bf-blender-cvs mailing list