Skip to content

Commit 3644095

Browse files
committed
Refuse to create zero area bitmap
1 parent 8e4b3a2 commit 3644095

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/tigr_bitmaps.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ void tigrResize(Tigr* bmp, int w, int h) {
7171
}
7272

7373
int tigrCalcScale(int bmpW, int bmpH, int areaW, int areaH) {
74+
if (bmpW == 0 || bmpH == 0) {
75+
tigrError(0, "Invalid bitmap size, (%dx%d)", bmpW, bmpH);
76+
}
7477
// We want it as big as possible in the window, but still
7578
// maintaining the correct aspect ratio, and always
7679
// having an integer pixel size.

tigr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ void tigrResize(Tigr* bmp, int w, int h) {
327327
}
328328

329329
int tigrCalcScale(int bmpW, int bmpH, int areaW, int areaH) {
330+
if (bmpW == 0 || bmpH == 0) {
331+
tigrError(0, "Invalid bitmap size, (%dx%d)", bmpW, bmpH);
332+
}
330333
// We want it as big as possible in the window, but still
331334
// maintaining the correct aspect ratio, and always
332335
// having an integer pixel size.

0 commit comments

Comments
 (0)