diff options
author | Ton Roosendaal <ton@blender.org> | 2006-06-11 12:22:15 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-06-11 12:22:15 +0400 |
commit | b2157d2fff47ab1e1779cb22308b45c4df2d49cf (patch) | |
tree | 79c6bfccf118f39a3ae7b312dc01c54d5a39ebde /source/blender/src/interface_icons.c | |
parent | 862ac0449414365caf15ddc68baeced6ad881edf (diff) |
Bugfix 4304
Another case where the preview icons fail... when images cannot be loaded,
the icons code crashed. Added tests for that.
Diffstat (limited to 'source/blender/src/interface_icons.c')
-rw-r--r-- | source/blender/src/interface_icons.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c index f81e09fa162..73fecbcea0e 100644 --- a/source/blender/src/interface_icons.c +++ b/source/blender/src/interface_icons.c @@ -625,7 +625,7 @@ static void icon_copy_rect(ImBuf *ibuf, RenderInfo *ri) short ex, ey, dx, dy; /* paranoia test */ - if(ibuf->rect==NULL && ibuf->rect_float==NULL) + if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) return; /* waste of cpu cyles... but the imbuf API has no other way to scale fast (ton) */ @@ -673,7 +673,8 @@ static void icon_from_image(Image *img, RenderInfo *ri) unsigned int pr_size = ri->pr_rectx*ri->pr_recty*sizeof(unsigned int); short image_loaded = 0; - if (!img) + /* img->ok is zero when Image cannot load */ + if (img==NULL || img->ok==0) return; if (!ri->rect) { @@ -685,7 +686,9 @@ static void icon_from_image(Image *img, RenderInfo *ri) always loading and reducing images is too expensive */ if(!img->preview) { if(img->ibuf==NULL || img->ibuf->rect==NULL) { - load_image(img, IB_rect, G.sce, G.scene->r.cfra); + load_image(img, IB_rect, G.sce, G.scene->r.cfra); + if(img->ok==0) + return; image_loaded = 1; } icon_copy_rect(img->ibuf, ri); |