mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17: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:
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue