diff options
-rw-r--r-- | source/blender/editors/space_image/image_edit.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 360cbc3f026..79d01491df7 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -230,13 +230,19 @@ void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy) void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *aspx, float *aspy) { - int w, h; + if (ima) { + int w, h; - BKE_image_get_aspect(ima, aspx, aspy); - BKE_image_get_size(ima, iuser, &w, &h); + BKE_image_get_aspect(ima, aspx, aspy); + BKE_image_get_size(ima, iuser, &w, &h); - *aspx *= (float)w; - *aspy *= (float)h; + *aspx *= (float)w; + *aspy *= (float)h; + } + else { + *aspx = 1.0f; + *aspy = 1.0f; + } } /* takes event->mval */ |