Skip to content

Commit

Permalink
fix crash when window too small
Browse files Browse the repository at this point in the history
  • Loading branch information
lets-all-be-stupid-forever committed Sep 28, 2024
1 parent bfcf51f commit a44b7c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/w_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ void MainUpdateViewport(Ui* ui) {
};
int tgt_size_x = sw - C.target_pos.x - pad - tt - 8 * scale - 35 * scale;
int tgt_size_y = sh - C.bottom_size - C.header_size - tt;
// Avoids crashing when window is too small
const int min_tgt_size = 32;
tgt_size_x = MaxInt(min_tgt_size, tgt_size_x);
tgt_size_y = MaxInt(min_tgt_size, tgt_size_y);
if (tgt_size_x != C.img_target_tex.texture.width ||
tgt_size_y != C.img_target_tex.texture.height) {
if (C.img_target_tex.texture.width > 0) {
Expand Down

0 comments on commit a44b7c6

Please sign in to comment.