Genisys icon indicating copy to clipboard operation
Genisys copied to clipboard

Call to a member function clearAll() on null

Open jarne opened this issue 9 years ago • 2 comments

Issue description

I'm resetting the inventory of players on PlayerInteractEvent and PlayerQuitEvent with $inventory->clearAll(); in my plugin, but it throws errors sometimes.

Steps to reproduce the issue

It's very difficult to reproduce because it only happens sometimes. Just call $inventory->clearAll(); on PlayerQuitEvent or on interact with sign, and it'll crash after some players. When I open a test server on my network, it happens after 3-4 hours which are about 100 players who were on the server.

OS and versions

  • Genisys: 8e139ea
  • PHP: 7.0.9
  • Server OS: Debian 8.5 x64
  • Game version: 0.15.6 PE on iOS

Crashdump, backtrace, memory dumps, plugins list or other files

[36m[15:05:40] [m[31m[Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerQuitEvent' to 'JumpLeague v1.0.0': Call to a member function clearAll() on null on jjplaying\JumpLeague\EventListener[m
[36m[15:05:40] [m[31m[Server thread/CRITICAL]: Error: "Call to a member function clearAll() on null" (EXCEPTION) in "/src/pocketmine/Player" at line 1347[m

[36m[15:12:43] [m[31m[Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'JumpLeague v1.0.0': Call to a member function clearAll() on null on jjplaying\JumpLeague\EventListener[m
[36m[15:12:43] [m[31m[Server thread/CRITICAL]: Error: "Call to a member function clearAll() on null" (EXCEPTION) in "/src/pocketmine/Player" at line 1347[m

[36m[15:51:06] [m[31m[Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'JumpLeague v1.0.0': Call to a member function clearAll() on null on jjplaying\JumpLeague\EventListener[m
[36m[15:51:06] [m[31m[Server thread/CRITICAL]: Error: "Call to a member function clearAll() on null" (EXCEPTION) in "/src/pocketmine/Player" at line 1347[m

jarne avatar Sep 04 '16 20:09 jarne

Most likely it's a timing issue. Will be investigated.

dktapps avatar Sep 04 '16 20:09 dktapps

@dktapps What if another event was added ex) "PlayerPreQuitEvent" that was called by the server before PlayerQuitEvent was called?

0x15f avatar Sep 12 '16 21:09 0x15f