Skip to content

Commit

Permalink
loading-bar: fix crash if percent over 100 or under 0
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
cosmo-ray committed May 5, 2024
1 parent 572264e commit d684912
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/loading_bar/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ void *lbSetPercent(int nbArg, void **args)
{
Entity *entity = args[0];
int percent = (intptr_t)args[1];
if (percent > 100)
percent = 100;
if (percent < 0)
percent = 0;
int tot_pix = bar_w - (2 * border_len);
yeAutoFree Entity *info = yeCreateArray(NULL, NULL);
uint8_t *tmp = map;
Expand Down

0 comments on commit d684912

Please sign in to comment.