Fran 99 Share Posted February 16, 2015 Hi guys, need help with the following error (I am new to Java and scripting, so will appreciate if you can be explicit :-)) The player levelled up and the following exception error popped: java.lang.NullPointerException Can someone please guide me on how should I modify the code to avoid this? Thanks! Link to comment Share on other sites More sharing options...
Soldtodie 76 Share Posted February 16, 2015 (edited) You want to call a method from an object that is null. Edited February 16, 2015 by Soldtodie Link to comment Share on other sites More sharing options...
Nuclear Nezz 1993 Share Posted February 16, 2015 There's not much we can tell you without the stack trace, which should have been printed in the console. :x You're making a call somewhere on a null object. This would be like if you're getting nearby chickens and there are no chickens available and you call chicken.interact("Attack") anyway, it'll throw an NPE because chicken is null. Link to comment Share on other sites More sharing options...
Polish Civil 90 Share Posted February 17, 2015 Dayum son, chance getting this error comparing to all other possible errors is like finding sand on beach. By avoiding this:Polish's advanced technique for no scopers 720 blaze it: if(object != null){ ... } Vlad, Dogerina, DefCon and 1 other 4 Link to comment Share on other sites More sharing options...
Dogerina 330 Share Posted February 17, 2015 Dayum son, chance getting this error comparing to all other possible errors is like finding sand on beach. By avoiding this: Polish's advanced technique for no scopers 720 blaze it: if(object != null){ ... } 840 double blaze it Nuclear Nezz and Polish Civil 2 Link to comment Share on other sites More sharing options...
Recommended Posts