mirror of
https://github.com/minetest/minetest.git
synced 2024-11-24 00:23:46 +01:00
src/environment.cpp: Fix NULL pointer dereference
This commit is contained in:
parent
79e2647556
commit
67997af67f
@ -1820,20 +1820,21 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
|
|||||||
bool stays_in_same_block = false;
|
bool stays_in_same_block = false;
|
||||||
bool data_changed = true;
|
bool data_changed = true;
|
||||||
|
|
||||||
if(obj->m_static_exists){
|
if (obj->m_static_exists) {
|
||||||
if(obj->m_static_block == blockpos_o)
|
if (obj->m_static_block == blockpos_o)
|
||||||
stays_in_same_block = true;
|
stays_in_same_block = true;
|
||||||
|
|
||||||
MapBlock *block = m_map->emergeBlock(obj->m_static_block, false);
|
MapBlock *block = m_map->emergeBlock(obj->m_static_block, false);
|
||||||
|
|
||||||
|
if (block) {
|
||||||
std::map<u16, StaticObject>::iterator n =
|
std::map<u16, StaticObject>::iterator n =
|
||||||
block->m_static_objects.m_active.find(id);
|
block->m_static_objects.m_active.find(id);
|
||||||
if(n != block->m_static_objects.m_active.end()){
|
if (n != block->m_static_objects.m_active.end()) {
|
||||||
StaticObject static_old = n->second;
|
StaticObject static_old = n->second;
|
||||||
|
|
||||||
float save_movem = obj->getMinimumSavedMovement();
|
float save_movem = obj->getMinimumSavedMovement();
|
||||||
|
|
||||||
if(static_old.data == staticdata_new &&
|
if (static_old.data == staticdata_new &&
|
||||||
(static_old.pos - objectpos).getLength() < save_movem)
|
(static_old.pos - objectpos).getLength() < save_movem)
|
||||||
data_changed = false;
|
data_changed = false;
|
||||||
} else {
|
} else {
|
||||||
@ -1843,6 +1844,7 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
|
|||||||
<<PP(obj->m_static_block)<<std::endl;
|
<<PP(obj->m_static_block)<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool shall_be_written = (!stays_in_same_block || data_changed);
|
bool shall_be_written = (!stays_in_same_block || data_changed);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user