mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix null dereference in weather update functions
This commit is contained in:
parent
c0398224ef
commit
f7ee5da4c1
12
src/map.cpp
12
src/map.cpp
@ -3935,8 +3935,10 @@ s16 ServerMap::updateBlockHeat(ServerEnvironment *env, v3s16 p, MapBlock *block)
|
|||||||
f32 heat = m_emerge->biomedef->calcBlockHeat(p, m_seed,
|
f32 heat = m_emerge->biomedef->calcBlockHeat(p, m_seed,
|
||||||
env->getTimeOfDayF(), gametime * env->getTimeOfDaySpeed());
|
env->getTimeOfDayF(), gametime * env->getTimeOfDaySpeed());
|
||||||
|
|
||||||
block->heat = heat;
|
if(block) {
|
||||||
block->weather_update_time = gametime;
|
block->heat = heat;
|
||||||
|
block->weather_update_time = gametime;
|
||||||
|
}
|
||||||
return heat;
|
return heat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3954,8 +3956,10 @@ s16 ServerMap::updateBlockHumidity(ServerEnvironment *env, v3s16 p, MapBlock *bl
|
|||||||
f32 humidity = m_emerge->biomedef->calcBlockHumidity(p, m_seed,
|
f32 humidity = m_emerge->biomedef->calcBlockHumidity(p, m_seed,
|
||||||
env->getTimeOfDayF(), gametime * env->getTimeOfDaySpeed());
|
env->getTimeOfDayF(), gametime * env->getTimeOfDaySpeed());
|
||||||
|
|
||||||
block->humidity = humidity;
|
if(block) {
|
||||||
block->weather_update_time = gametime;
|
block->humidity = humidity;
|
||||||
|
block->weather_update_time = gametime;
|
||||||
|
}
|
||||||
return humidity;
|
return humidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user