In Java Slick2D, I am attempting to make a line using a constructor that takes two float arrays, as detailed here: http://slick.ninjacave.com/javadoc/org/newdawn/slick/geom/Line.html
My code is the following:
float[] floatArray1 = { 10.0f, 155.0f };
float[] floatArray2 = { 20.0f, 165.0f };
Line line1 = new Line ( floatArray1, floatArray2 );
However, this third line (line 263 in my code) throws a NullPointerException:
java.lang.NullPointerException
at org.newdawn.slick.geom.Line.set(Line.java:217)
at org.newdawn.slick.geom.Line.set(Line.java:138)
at org.newdawn.slick.geom.Line.<init>(Line.java:112)
at view.play.Character.checkIntersectionMovementVector(Character.java:263) (my method)
Why is this happening?
Edit: It is worth noting that using its constructor that takes four float values instead of two float arrays of length two works, and throws no exception:
Line line = new Line ( 10.0f, 155.0f, 20.0f, 165.0f );