supercrafter333 / PlayedTime

A PocketMine-MP plugin that counts the played time of players.
Apache License 2.0
6 stars 1 forks source link

Crash if a player has a space in his name #7

Closed MrBlasyMSK closed 2 years ago

MrBlasyMSK commented 2 years ago

If you try to see the time played of a player with a space in the name it will crash Command used: /playedtime time "Player Space"

PocketMine-MP Crash Dump Thu May 12 14:45:54 UTC 2022

PocketMine-MP version: 4.3.2 [Protocol 503]
Git commit: 755ca1af9b1b69226a6ed4597dc947aeec8088fe
PHP version: 8.0.18
OS: Linux, linux

THIS CRASH WAS CAUSED BY A PLUGIN
BAD PLUGIN: PlayedTime

Error: supercrafter333\PlayedTime\PlayedTimeManager::getTotalTime(): Argument #1 ($player) must be of type pocketmine\player\Player|string, null given, called in phar:///home/container/plugins/PlayedTime_dev-8.phar/src/PlayedTimeCommand.php on line 176
File: plugins/PlayedTime_dev-8.phar/src/PlayedTimeManager
Line: 117
Type: TypeError
Backtrace:
#0 plugins/PlayedTime_dev-8.phar/src/PlayedTimeCommand(176): supercrafter333\PlayedTime\PlayedTimeManager->getTotalTime(NULL )
#1 pmsrc/src/command/SimpleCommandMap(220): supercrafter333\PlayedTime\PlayedTimeCommand->execute(object ipad54\netherblocks\player\Player#28889, string[10] playedtime, array[1])
#2 pmsrc/src/Server(1409): pocketmine\command\SimpleCommandMap->dispatch(object ipad54\netherblocks\player\Player#28889, string[31] playedtime time "slinky co4151")
#3 pmsrc/src/player/Player(1402): pocketmine\Server->dispatchCommand(object ipad54\netherblocks\player\Player#28889, string[31] playedtime time "slinky co4151")
#4 pmsrc/src/network/mcpe/handler/InGamePacketHandler(754): pocketmine\player\Player->chat(string[32] /playedtime time "slinky co4151")
#5 pmsrc/vendor/pocketmine/bedrock-protocol/src/CommandRequestPacket(51): pocketmine\network\mcpe\handler\InGamePacketHandler->handleCommandRequest(object pocketmine\network\mcpe\protocol\CommandRequestPacket#635197)
#6 pmsrc/src/network/mcpe/NetworkSession(398): pocketmine\network\mcpe\protocol\CommandRequestPacket->handle(object CLADevs\VanillaX\network\InGamePacketHandlerX#613913)
#7 pmsrc/src/network/mcpe/NetworkSession(361): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\CommandRequestPacket#635197, string[53] M /playedtime time "slinky co4151"..K.!..b.T.I..$....)
#8 pmsrc/src/network/mcpe/raklib/RakLibInterface(192): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[53] 3.U./.I.LM)..MU..J.9.y.....&...J.;.{...%5.l..wSe.4...)
#9 pmsrc/vendor/pocketmine/raklib-ipc/src/RakLibToUserThreadMessageReceiver(42): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(integer 0, string[62] ..=7.'..u..*..'.g39h......GF.|..,.........XG.}.%.N+.l.=*..|QHD)
#10 pmsrc/src/network/mcpe/raklib/RakLibInterface(122): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface#27971)
#11 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
#12 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
#13 pmsrc/src/Server(1661): pocketmine\snooze\SleeperHandler->sleepUntil(double 1652366754.3691)
#14 pmsrc/src/Server(1047): pocketmine\Server->tickProcessor()
#15 pmsrc/src/PocketMine(304): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[16] /home/container/, string[24] /home/container/plugins/)
#16 pmsrc/src/PocketMine(327): pocketmine\server()
#17 pmsrc(11): require(string[60] phar:///home/container/PocketMine-MP.phar/src/PocketMine.php)
supercrafter333 commented 2 years ago

Thank you for report.