1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-30 08:07:46 +00:00

Check for nullptr before using returned map data

It's best to not crash the server if we can help it.
This commit is contained in:
Sophie Hamilton 2020-03-03 08:37:19 +00:00
parent 1fc067a3e6
commit 8f62c23a8b

View file

@ -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;
}
}