From 12f5603b1148df2f0e51da0d71358fa93a90d7e8 Mon Sep 17 00:00:00 2001 From: Sophie Hamilton Date: Tue, 3 Mar 2020 08:37:19 +0000 Subject: [PATCH] Check for nullptr before using returned map data It's best to not crash the server if we can help it. --- src/world/Actor/Player.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 89ead563..73f420f5 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -604,6 +604,12 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id ) int32_t offset = 4; auto info = exdData.get< Sapphire::Data::Map >( map_id ); + if ( !info ) + { + sendDebug( "discover(): Could not obtain map data for map_id == {0}", map_id ); + return; + } + if( info->discoveryArrayByte ) offset = 5 + 2 * info->discoveryIndex; else @@ -2199,4 +2205,4 @@ bool Sapphire::Entity::Player::checkAction() } return true; -} \ No newline at end of file +}