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
m_env->getGameDef()->sendDetachedInventory(
nullptr, name, player->getPeerId());
- } else {
- // Notify all players about the change
+ } else if (m_env) {
+ // Notify all players about the change as soon ServerEnv exists
m_env->getGameDef()->sendDetachedInventory(
nullptr, name, PEER_ID_INEXISTENT);
}