[Fix] Fixed possible segfault.

This commit is contained in:
Allanis 2014-05-29 21:40:49 +01:00
parent 34358a6b66
commit 9b4175d5a1

View File

@ -2249,17 +2249,17 @@ void player_afterburnOver(void) {
* @param acc How much thrust should be applied of maximum (0 - 1). * @param acc How much thrust should be applied of maximum (0 - 1).
*/ */
void player_accel(double acc) { 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; return;
if(player != NULL) { player_acc = acc;
player_acc = acc; sound_stopGroup(PLAYER_ENGINE_CHANNEL);
sound_stopGroup(PLAYER_ENGINE_CHANNEL); sound_playGroup(PLAYER_ENGINE_CHANNEL,
sound_playGroup(PLAYER_ENGINE_CHANNEL, player->ship->sound, 0);
player->ship->sound, 0);
if(toolkit || paused) if(toolkit || paused)
player_soundPause(); player_soundPause();
}
} }
/** /**