Skip to content

Commit

Permalink
Fixed NPE when using the main menu button on sellhead
Browse files Browse the repository at this point in the history
  • Loading branch information
Thatsmusic99 committed Apr 17, 2020
1 parent b6e71e5 commit 0d63292
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static void initiateInvsAndIcons() {
inventories.put(InventoryType.CHALLENGES_MENU, ChallengesMenu.class);
inventories.put(InventoryType.CHALLENGES_LIST, ChallengesSection.class);
inventories.put(InventoryType.CHALLENGES_PINNED, ChallengesPinnedInv.class);
inventories.put(InventoryType.SELLHEAD_CATEGORY, SellheadCategory.class);

// Allow icons to have their own character
cachedIcons.put('C', Content.class);
Expand Down Expand Up @@ -94,6 +95,10 @@ public boolean isGlitchSlotFilled() {

public void open(InventoryType type, HashMap<String, String> context) {
// Check if a new inventory is being opened and reset the page
if (type == null) {
Bukkit.getPlayer(player).closeInventory();
return;
}
if (type != this.type) {
currentPage = 1;
section = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public boolean onClick(Player player, InventoryClickEvent event) {
break;
case SELLHEAD_MENU:
case SELLHEAD_CATEGORY:
type = InventoryManager.InventoryType.SELLHEAD_MENU;
type = null;
break;
case CHALLENGES_PINNED:
case CHALLENGES_LIST:
Expand Down

0 comments on commit 0d63292

Please sign in to comment.