From 9b4175d5a1020cf485f67ea407874da28a3da426 Mon Sep 17 00:00:00 2001 From: Allanis Date: Thu, 29 May 2014 21:40:49 +0100 Subject: [PATCH] [Fix] Fixed possible segfault. --- src/player.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/player.c b/src/player.c index ef10c74..9be6006 100644 --- a/src/player.c +++ b/src/player.c @@ -2249,17 +2249,17 @@ void player_afterburnOver(void) { * @param acc How much thrust should be applied of maximum (0 - 1). */ void player_accel(double acc) { - if(pilot_isFlag(player, PILOT_HYP_PREP) || pilot_isFlag(player, PILOT_HYPERSPACE)) + if((player == NULL) || pilot_isFlag(player, PILOT_HYP_PREP) || + pilot_isFlag(player, PILOT_HYPERSPACE)) return; - if(player != NULL) { - player_acc = acc; - sound_stopGroup(PLAYER_ENGINE_CHANNEL); - sound_playGroup(PLAYER_ENGINE_CHANNEL, - player->ship->sound, 0); - if(toolkit || paused) - player_soundPause(); - } + player_acc = acc; + sound_stopGroup(PLAYER_ENGINE_CHANNEL); + sound_playGroup(PLAYER_ENGINE_CHANNEL, + player->ship->sound, 0); + + if(toolkit || paused) + player_soundPause(); } /**