mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2025-01-09 16:38:13 +00:00
Null pointer check
Players who haven't joined your server since the UUID conversion will have a null name. As a result, if you try to /openinv a player who *has* joined your server since then, the loop can break due to a NPE while checking other players. This null check should fix that problem.
This commit is contained in:
parent
c2c7996da5
commit
bbacb04636
1 changed files with 2 additions and 1 deletions
|
@ -80,7 +80,8 @@ public class PlayerDataManager implements IPlayerDataManager {
|
||||||
OfflinePlayer[] offlinePlayers = Bukkit.getOfflinePlayers();
|
OfflinePlayer[] offlinePlayers = Bukkit.getOfflinePlayers();
|
||||||
for (OfflinePlayer player : offlinePlayers) {
|
for (OfflinePlayer player : offlinePlayers) {
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
|
if (name == null)
|
||||||
|
continue;
|
||||||
if (name.equalsIgnoreCase(search))
|
if (name.equalsIgnoreCase(search))
|
||||||
return player.getUniqueId();
|
return player.getUniqueId();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue