diff --git a/src/pocketmine/MemoryManager.php b/src/pocketmine/MemoryManager.php index 0585ae77b..4208d5fb1 100644 --- a/src/pocketmine/MemoryManager.php +++ b/src/pocketmine/MemoryManager.php @@ -92,7 +92,7 @@ class MemoryManager{ $hardLimit = ((int) $this->server->getProperty("memory.main-hard-limit", $defaultMemory)); if($hardLimit <= 0){ - ini_set("memory_limit", -1); + ini_set("memory_limit", '-1'); }else{ ini_set("memory_limit", $hardLimit . "M"); } diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index b2c37c22f..5b2ea05b1 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1999,9 +1999,11 @@ class Server{ $this->getLogger()->debug("Removing event handlers"); HandlerList::unregisterAll(); - $this->getLogger()->debug("Stopping all tasks"); - $this->scheduler->cancelAllTasks(); - $this->scheduler->mainThreadHeartbeat(PHP_INT_MAX); + if($this->scheduler instanceof ServerScheduler){ + $this->getLogger()->debug("Stopping all tasks"); + $this->scheduler->cancelAllTasks(); + $this->scheduler->mainThreadHeartbeat(PHP_INT_MAX); + } $this->getLogger()->debug("Saving properties"); $this->properties->save(); @@ -2010,10 +2012,12 @@ class Server{ $this->console->shutdown(); $this->console->notify(); - $this->getLogger()->debug("Stopping network interfaces"); - foreach($this->network->getInterfaces() as $interface){ - $interface->shutdown(); - $this->network->unregisterInterface($interface); + if($this->network instanceof Network){ + $this->getLogger()->debug("Stopping network interfaces"); + foreach($this->network->getInterfaces() as $interface){ + $interface->shutdown(); + $this->network->unregisterInterface($interface); + } } gc_collect_cycles();