dillydill123 / inventory-setups

Plugin for RuneLite, an open source game client for the MMO Old School RuneScape
https://runelite.net/plugin-hub/dillydill123
BSD 2-Clause "Simplified" License
53 stars 30 forks source link

NPE when searching a bird nest #64

Closed emerald000 closed 4 years ago

emerald000 commented 4 years ago

When you click on a bird nest to "search" and receive the seeds, the plugin throws an NPE:

WARN  n.runelite.client.eventbus.EventBus - Uncaught exception in event subscriber
java.lang.NullPointerException: null
    at inventorysetups.InventorySetupsPlugin.onMenuOptionClicked(InventorySetupsPlugin.java:549)
    at net.runelite.client.eventbus.EventBus$Subscriber.invoke(EventBus.java:73)
    at net.runelite.client.eventbus.EventBus.post(EventBus.java:222)
    at net.runelite.client.callback.Hooks.post(Hooks.java:165)
    at hn.hm(hn.java:31423)
    at client.cr(client.java:3407)
    at client.ah(client.java:1587)
    at ba.x(ba.java:335)
    at ba.run(ba.java:314)
    at java.lang.Thread.run(Thread.java:748)
dillydill123 commented 4 years ago

I think this is occurring for anything with "Search" because there is some code to make the search function of banks work with the filtering. I am not checking to see if the bank is open (widget is null) before trying to use it. If you don't have a setup selected, I think you will not get the NPE.

Nice find! I will fix this.

dillydill123 commented 4 years ago

Were you searching the nest in a specific area? I can't seem to get reproduce the bug. The widget is not null I will still add this check in though.

emerald000 commented 4 years ago

I was right in front of the south-west bird house.

dillydill123 commented 4 years ago

Ahh I got it. If you don't visit a bank before searching a nest, the widget will be null and cause the NPE.

dillydill123 commented 4 years ago

Fixed in 1.8.2