fix a NULL pointer dereference in ResizeGamestates

This commit is contained in:
Sebastian Krzyszkowiak 2019-01-11 15:25:24 +01:00
parent 996c7e4d8e
commit 1334fc6b1d
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
2 changed files with 8 additions and 5 deletions

View file

@ -167,12 +167,14 @@ SYMBOL_INTERNAL void ResizeGamestates(struct Game* game) {
} }
tmp = tmp->next; tmp = tmp->next;
} }
if (game->_priv.loading.gamestate) {
al_destroy_bitmap(game->_priv.loading.gamestate->fb); al_destroy_bitmap(game->_priv.loading.gamestate->fb);
if (game->_priv.params.handlers.compositor) { if (game->_priv.params.handlers.compositor) {
game->_priv.loading.gamestate->fb = CreateNotPreservedBitmap(game->clip_rect.w, game->clip_rect.h); game->_priv.loading.gamestate->fb = CreateNotPreservedBitmap(game->clip_rect.w, game->clip_rect.h);
} else { } else {
game->_priv.loading.gamestate->fb = al_create_sub_bitmap(al_get_backbuffer(game->display), game->clip_rect.x, game->clip_rect.y, game->clip_rect.w, game->clip_rect.h); game->_priv.loading.gamestate->fb = al_create_sub_bitmap(al_get_backbuffer(game->display), game->clip_rect.x, game->clip_rect.y, game->clip_rect.w, game->clip_rect.h);
} }
}
} }
SYMBOL_INTERNAL void DrawConsole(struct Game* game) { SYMBOL_INTERNAL void DrawConsole(struct Game* game) {

View file

@ -458,6 +458,7 @@ SYMBOL_EXPORT void PrintConsoleWithContext(struct Game* game, int line, const ch
fflush(stdout); fflush(stdout);
#endif #endif
} }
game->_priv.console_pos++; game->_priv.console_pos++;
if (game->_priv.console_pos >= (sizeof(game->_priv.console) / sizeof(game->_priv.console[0]))) { if (game->_priv.console_pos >= (sizeof(game->_priv.console) / sizeof(game->_priv.console[0]))) {
game->_priv.console_pos = 0; game->_priv.console_pos = 0;