[Re-sizable mode] Null Pointer Exception caused by a non-null value
Description of the bug (be specific): Only occurs in re-sizable mode. A checked, non-null value throws a Null Pointer Exception. Scripts that sell all the inventory items at Grand Exchange will crash in re-sizable mode after the first item is sold. I've written the steps required to replicate this bug at the bottom of the page.
How often the bug occurs:
Triggers of the bug (if known): Written at the bottom of the page.
Java version: 1.8.0_171 64bit
Max Heap Size: 1000MB
TRiBot client version: 9.312_5
Looking Glass (yes/no): No
Operating System: Windows 7
Script Name: -
TRiBot Old-School or RS3: Old-School
Client Debug:
Bot Debug:
Screenshots (if any):
How to replicate this bug:
- Enable re-sizable mode.
- Get some random items in the inventory.
- The first inventory slot must be free: https://i.imgur.com/tBsalna.png
- Open Grand Exchange.
- Run this code:
@Override public void run() { RSItem[] items = Inventory.getAll(); if (items.length > 0 && items[0] != null) { General.println("Is items 0 null? " + (items[0] == null)); General.println("Here comes the bug:"); items[0].click(); // This line throws NPE } }
Running the same code in fixed mode will not throw the Null Pointer Exception. This only occurs in re-sizable mode when the Grand Exchange is open.
Client debug:
Script Started: Test. Is items 0 null? false Here comes the bug: java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at java.util.Optional.<init>(Optional.java:96) at java.util.Optional.of(Optional.java:108) at org.tribot.api2007.types.RSItem.DN(tl:205) at org.tribot.api2007.types.RSItem.getArea(tl:91) at org.tribot.api2007.types.RSItem.hover(tl:257) at org.tribot.api2007.types.RSItem.click(tl:578) at org.tribot.api2007.types.RSItem.click(tl:282) at org.tribot.api2007.types.RSItem.click(tl:252) at scripts.Test.run(Test.java:27) at java.lang.Thread.run(Thread.java:748) Script Ended: Test.