From ac44cbdf75a55caf06b97e4ba427fcfde5ba944f Mon Sep 17 00:00:00 2001 From: Julie Marchant Date: Sun, 26 May 2019 17:43:14 -0400 Subject: [PATCH] fixed the long-standing segfault, plus fixed a bug with the Dorim mission. So, that segfault? Turns out there's a place where I forgot to check if something was NULL before accessing it, which turned out to be important because for some reason, gfx_textSprites[TS_RADIO] got set to 32 at some point while gfx_messageBox remained NULL. This may be indicative of a memory leak somewhere, but it's also possible that maybe it was left-over from a previous mission or something, which may have been what made it so hard to spot (that would make the bug time-sensitive as well as context-sensitive). In any case, at least the segfault is fixed now. --- src/game.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index 93afb76..95342e8 100644 --- a/src/game.c +++ b/src/game.c @@ -1928,7 +1928,7 @@ static void game_doHud() } // Show the radio message if there is one - if (gfx_textSprites[TS_RADIO].life > 0) + if ((gfx_textSprites[TS_RADIO].life > 0) && (gfx_messageBox != NULL)) { screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, 50); gfx_textSprites[TS_RADIO].life--; @@ -2222,6 +2222,7 @@ int game_mainLoop() { aliens[0].collectChance = 100; aliens[0].collectType = P_ESCAPEPOD; + aliens[0].collectTypeOriginal = P_ESCAPEPOD; } // Some specifics for interception missions