PneumaticCraft: Repressurized

PneumaticCraft: Repressurized

50M Downloads

Security Station / Fake Player crash in single player

jeremiahwinsley opened this issue ยท 2 comments

commented

For feature requests, just erase this template and clearly describe the feature you'd like to see

Minecraft Version

1.16.5

Forge Version

36.2.20

Mod Version

pneumaticcraft-repressurized-1.16.5-2.14.6-277.jar

Describe your problem, including steps to reproduce it

This is probably a bug with the mod creating the fake player, since it's creating an incomplete GameProfile, but there are likely other mods that do the same thing and might be worth patching here.

In a single player survival world, where cheats are enabled, and a fake player with a GameProfile containing UUID but not name, attempts to break a block that's protected by the security station, the station fails to get the player name and crashes.

https://gist.github.com/jeremiahwinsley/2ad90776ad51cd851161e853255498e9

return player.isCreative() || (player.getGameProfile().getId() != null && player.createCommandSourceStack().hasPermission(2));

The hasPermission() call here under these circumstances calls getName() on the profile and uses it directly without checking for null. This is probably a vanilla or Forge bug itself, since getName() is documented to return null, but a quick solution would be call GameProfile.isComplete() instead of GameProfile.getId() != null.

Any other comments?

commented

Fixed in 2.14.7 release

commented

Agreed, that looks like a reasonable fix.