Skip to content

Commit

Permalink
Fix null dereference in weather update functions
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Sep 17, 2013
1 parent c039822 commit f7ee5da
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/map.cpp
Expand Up @@ -3935,8 +3935,10 @@ s16 ServerMap::updateBlockHeat(ServerEnvironment *env, v3s16 p, MapBlock *block)
f32 heat = m_emerge->biomedef->calcBlockHeat(p, m_seed,
env->getTimeOfDayF(), gametime * env->getTimeOfDaySpeed());

block->heat = heat;
block->weather_update_time = gametime;
if(block) {
block->heat = heat;
block->weather_update_time = gametime;
}
return heat;
}

Expand All @@ -3954,8 +3956,10 @@ s16 ServerMap::updateBlockHumidity(ServerEnvironment *env, v3s16 p, MapBlock *bl
f32 humidity = m_emerge->biomedef->calcBlockHumidity(p, m_seed,
env->getTimeOfDayF(), gametime * env->getTimeOfDaySpeed());

block->humidity = humidity;
block->weather_update_time = gametime;
if(block) {
block->humidity = humidity;
block->weather_update_time = gametime;
}
return humidity;
}

Expand Down

0 comments on commit f7ee5da

Please sign in to comment.