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:
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
|
@ -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) {
|
||||
|
|
|
@ -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! */
|
||||
|
|
Loading…
Reference in New Issue