mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 00:27:44 +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:
parent
1fc067a3e6
commit
8f62c23a8b
1 changed files with 7 additions and 1 deletions
|
@ -604,6 +604,12 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
||||||
int32_t offset = 4;
|
int32_t offset = 4;
|
||||||
|
|
||||||
auto info = exdData.get< Sapphire::Data::Map >( map_id );
|
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 )
|
if( info->discoveryArrayByte )
|
||||||
offset = 5 + 2 * info->discoveryIndex;
|
offset = 5 + 2 * info->discoveryIndex;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue