Fix error scaling thumbnails to zero dimensions

Follow up to fix for T89868.
This commit is contained in:
Campbell Barton 2021-08-28 19:57:31 +10:00 committed by Jeroen Bakker
parent 06317ce957
commit 5f156291cd
Notes: blender-bot 2023-02-13 22:19:21 +01:00
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 3 additions and 2 deletions

View File

@ -435,8 +435,9 @@ static ImBuf *thumb_create_ex(const char *file_path,
scaledy = (float)tsize;
scaledx = ((float)img->x / (float)img->y) * tsize;
}
ex = (short)scaledx;
ey = (short)scaledy;
/* Scaling down must never assign zero width/height, see: T89868. */
ex = MAX2(1, (short)scaledx);
ey = MAX2(1, (short)scaledy);
/* save some time by only scaling byte buf */
if (img->rect_float) {