mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
NetworkSession: Fixed InventoryManager nullability disaster
fixes #4277 fixes #4275 fixes #3139
This commit is contained in:
@ -136,7 +136,11 @@ abstract class BaseInventory implements Inventory{
|
||||
$listener->onSlotChange($this, $index, $before);
|
||||
}
|
||||
foreach($this->viewers as $viewer){
|
||||
$viewer->getNetworkSession()->getInvManager()->syncSlot($this, $index);
|
||||
$invManager = $viewer->getNetworkSession()->getInvManager();
|
||||
if($invManager === null){
|
||||
continue;
|
||||
}
|
||||
$invManager->syncSlot($this, $index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +154,11 @@ abstract class BaseInventory implements Inventory{
|
||||
}
|
||||
|
||||
foreach($this->getViewers() as $viewer){
|
||||
$viewer->getNetworkSession()->getInvManager()->syncContents($this);
|
||||
$invManager = $viewer->getNetworkSession()->getInvManager();
|
||||
if($invManager === null){
|
||||
continue;
|
||||
}
|
||||
$invManager->syncContents($this);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user