[Fix] Segfault with calculating new position of nebulae with no player.

This commit is contained in:
Allanis 2013-07-23 12:54:19 +01:00
parent 352083a0ce
commit 3fcdc8e288

View File

@ -13,7 +13,7 @@
#include "pause.h" #include "pause.h"
#include "perlin.h" #include "perlin.h"
#define NEBULAE_Z 16 /* Z plane. */ #define NEBULAE_Z 4 /* Z plane. */
#define NEBULAE_PUFFS 32 /* Amount of puffs to generate. */ #define NEBULAE_PUFFS 32 /* Amount of puffs to generate. */
#define NEBULAE_PATH_BG "gen/nebu_bg_%dx%d_%02d.png" #define NEBULAE_PATH_BG "gen/nebu_bg_%dx%d_%02d.png"
@ -357,7 +357,7 @@ void nebu_renderPuffs(const double dt, int below_player) {
(!below_player && (nebu_puffs[i].height > 1.))) { (!below_player && (nebu_puffs[i].height > 1.))) {
/* Calculate new position. */ /* Calculate new position. */
if(!paused) { if(!paused && (player != NULL)) {
nebu_puffs[i].x -= player->solid->vel.x * nebu_puffs[i].height * dt; nebu_puffs[i].x -= player->solid->vel.x * nebu_puffs[i].height * dt;
nebu_puffs[i].y -= player->solid->vel.y * nebu_puffs[i].height * dt; nebu_puffs[i].y -= player->solid->vel.y * nebu_puffs[i].height * dt;
} }