Null pointer where there should not be one...at all

Don’t even know why it was broken but yeah its not throwing any errors now

Rather than trying to solve the problem for you, I think it’d be more productive to explain how to solve the problem yourself.

Use a debugger.

If you run your code in Eclipse (or any other IDE), with the debugger attached, execution will halt as soon as an uncaught exception is thrown & you’ll be able to inspect the state of every relevant variable in your program.

Terminal exceptions like this should be trivial to fix if you’re programming with the correct tools & work process.

Well it depends , is t null or is the value returned null?

People actually code without using a debugger…?

I couldn’t even imagine not using a debugger… It would just be hours of un-needed headaches and frustration.

I have been using a debugger but there is nothing out of the ordinary, and there were no null values in that array. and yes it is printed out as null but can not be caught with ‘i == null’ or try{}catch(NullPointerExeption e){}

hm and yet t is so clearly null…

Cas :slight_smile:

Just one thing I was curious about when seeing your pastebin’ed Tile class:
You are already using a HashMap as an associative data structure to hold your tiles by associating a tile’s id with that tile.
Your lookup method (i.e. getTilebyID) then does not have to loop over the values in the map and compare the ids manually anymore, but can just use a Map.get(i).
Take care that you must not cast the argument to Map.get (your ‘i’) to byte, though. The compile-time type of the argument to Map.get in your case must be int or java.lang.Integer, as you are Map.put’ting it as java.lang.Integer in your constructor.

Thats why i was getting so stressed xD