Fix null pointer dereferences found by clang-tidy

This commit is contained in:
Sebastian Krzyszkowiak 2022-07-29 17:07:36 +02:00
parent 5cecd78234
commit 67b6a763c3
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
2 changed files with 2 additions and 2 deletions

View file

@ -635,7 +635,7 @@ SYMBOL_EXPORT void AnimateCharacter(struct Game* game, struct Character* charact
int pos = character->pos; int pos = character->pos;
while (character->delta >= character->frame->duration) { while (character->frame && character->delta >= character->frame->duration) {
bool reachedEnd = false; bool reachedEnd = false;
character->delta -= character->frame->duration; character->delta -= character->frame->duration;

View file

@ -57,7 +57,7 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
} }
tmp = tmp->next; tmp = tmp->next;
} }
if (game->loading.shown && game->_priv.loading.gamestate->api->predraw) { if (game->loading.shown && game->_priv.loading.gamestate && game->_priv.loading.gamestate->api->predraw) {
game->_priv.current_gamestate = game->_priv.loading.gamestate; game->_priv.current_gamestate = game->_priv.loading.gamestate;
game->_priv.loading.gamestate->api->predraw(game, game->_priv.loading.gamestate->data); game->_priv.loading.gamestate->api->predraw(game, game->_priv.loading.gamestate->data);
} }