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
This commit is contained in:
Philipp Oeser 2019-05-20 13:43:25 +02:00
parent 2cec669d34
commit bfe7fdedfc
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by issue #64867, Blender crashes when changin image source to Movie
2 changed files with 8 additions and 2 deletions

View File

@ -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) {

View File

@ -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! */