From 91eef646a59575bd9ae792e257bb6ad12fafc0b1 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 11 Feb 2020 13:23:03 +0100 Subject: Script API: Check that SAOs are still usable before attempting to use them --- src/content_sao.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/content_sao.cpp') diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 43c784b42..5119223a7 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -864,7 +864,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t p m_peer_id(peer_id_), m_is_singleplayer(is_singleplayer) { - assert(m_peer_id != 0); // pre-condition + SANITY_CHECK(m_peer_id != PEER_ID_INEXISTENT); m_prop.hp_max = PLAYER_MAX_HP_DEFAULT; m_prop.breath_max = PLAYER_MAX_BREATH_DEFAULT; @@ -1393,7 +1393,7 @@ bool PlayerSAO::setWieldedItem(const ItemStack &item) void PlayerSAO::disconnected() { - m_peer_id = 0; + m_peer_id = PEER_ID_INEXISTENT; m_pending_removal = true; } -- cgit v1.2.3