You win 8 Share 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... Link to comment Share on other sites More sharing options...
rokaHakor 171 Share 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") ); Link to comment Share on other sites More sharing options...
You win 8 Author Share 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 Link to comment Share on other sites More sharing options...
Hashtag 8670 Share Posted October 26, 2016 Link to comment Share on other sites More sharing options...
Diddy 265 Share Posted October 26, 2016 hihi xD Link to comment Share on other sites More sharing options...
Mad 86 Share 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. Link to comment Share on other sites More sharing options...
Hashtag 8670 Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.