You win 8 Posted October 26, 2016 Here is the section of my code which will throw the error Item potion = getInventory().get(i -> i.getName().contains("potion") ); if(potion != null){ potion.interact("Drink"); log("potion drank, squeeze time!"); i've tried contains(Aility) i have also tried the ID of the object (all 4 ) Yeah...
rokaHakor 171 Posted October 26, 2016 You need to make sure the filter filters out everything that is null before it tries to get names like this Item potion = getInventory().get(i -> i != null && i.getName().contains("potion") );
You win 8 Author Posted October 26, 2016 You need to make sure the filter filters out everything that is null before it tries to get names like this Item potion = getInventory().get(i -> i != null && i.getName().contains("potion") ); god dam it.. trying ti out now.. You need to make sure the filter filters out everything that is null before it tries to get names like this Item potion = getInventory().get(i -> i != null && i.getName().contains("potion") ); yep... fml
Mad 86 Posted October 28, 2016 He's technically right, it's not his code. Its due to the filter method not skipping null objects, which to me... makes zero sense on why it would attempt to check properties on a null object.
Hashtag 9071 Posted October 29, 2016 He's technically right, it's not his code. Its due to the filter method not skipping null objects, which to me... makes zero sense on why it would attempt to check properties on a null object. Actually that is true.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.