Skip to content

Commit

Permalink
Fixed NPE when clicking non gui items
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt committed Jun 23, 2021
1 parent 055159d commit b8832bc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/src/main/java/dev/triumphteam/gui/guis/GuiListener.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/**
* MIT License
*
* <p>
* Copyright (c) 2021 TriumphTeam
*
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -173,7 +173,9 @@ public void onGuiOpen(final InventoryOpenEvent event) {
private boolean isGuiItem(@Nullable final ItemStack currentItem, @Nullable final GuiItem guiItem) {
if (currentItem == null || guiItem == null) return false;
// Checks whether or not the Item is truly a GUI Item
return ItemNbt.getString(currentItem, "mf-gui").equals(guiItem.getUuid().toString());
final String nbt = ItemNbt.getString(currentItem, "mf-gui");
if (nbt == null) return false;
return nbt.equals(guiItem.getUuid().toString());
}

}

0 comments on commit b8832bc

Please sign in to comment.