diff options
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index f748ad64bc4..fe1f9097562 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -3891,7 +3891,12 @@ static void image_initialize_after_load(Image *ima, ImageUser *iuser, ImBuf *UNU BKE_image_tag_time(ima); ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser); - tile->ok = IMA_OK_LOADED; + /* Images should never get loaded if the corresponding tile does not exist, + * but we should at least not crash if it happens due to a bug elsewhere. */ + BLI_assert(tile != NULL); + if (tile != NULL) { + tile->ok = IMA_OK_LOADED; + } } static int imbuf_alpha_flags_for_image(Image *ima) @@ -4764,14 +4769,14 @@ BLI_INLINE bool image_quick_test(Image *ima, ImageUser *iuser) return false; } - ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser); - if (iuser) { if (iuser->ok == 0) { return false; } } - else if (tile == NULL) { + + ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser); + if (tile == NULL) { return false; } else if (tile->ok == 0) { |