mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Script API: Fix segfault in remove_detached_inventory
when minetest.remove_detached_inventory is called on script init, the environment is yet not set up, hence m_env is still nullptr until all scripts are loaded
This commit is contained in:
@@ -157,8 +157,8 @@ bool ServerInventoryManager::removeDetachedInventory(const std::string &name)
|
|||||||
m_env->getGameDef()->sendDetachedInventory(
|
m_env->getGameDef()->sendDetachedInventory(
|
||||||
nullptr, name, player->getPeerId());
|
nullptr, name, player->getPeerId());
|
||||||
|
|
||||||
} else {
|
} else if (m_env) {
|
||||||
// Notify all players about the change
|
// Notify all players about the change as soon ServerEnv exists
|
||||||
m_env->getGameDef()->sendDetachedInventory(
|
m_env->getGameDef()->sendDetachedInventory(
|
||||||
nullptr, name, PEER_ID_INEXISTENT);
|
nullptr, name, PEER_ID_INEXISTENT);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user