As the summary entails, the SDLEvent.pollEvent() method is throwing a NullPointerException. Here is some code:
[code]
public void start() {
boolean running = true;
do {
try {
SDLEvent event = SDLEvent.waitEvent();
if(event != null && event.getType() == SDLEvent.SDL_QUIT) {
running = false;
}
} catch(NullPointerException npe) {
System.out.println("Null pointer exception");
npe.printStackTrace();
System.exit(1);
} catch(SDLException ex) {
System.out.println("Exception!");
ex.printStackTrace();
running = false;
}
} while(running);
}
[/code]
Which results in the following when ran:
Null pointer exceptionjava.lang.NullPointerException
at sdljava.event.SDLActiveEvent.getType(SDLActiveEvent.java:70)
at sdlpong.GameManager.start(GameManager.java:50)
at sdlpong.Main.main(Main.java:7)
I'm not sure if this is a Bug or something I am doing incorrectly. Can anyone explain this?
Logged In: YES
user_id=1877905
Originator: NO
I realise that code isn't very easy to read.
I've uploaded the example code here:
http://www.jaldus.com/danny/files/SDLJava.java
Furthermore, it seems the swigActiveEvent object in the SDLActiveEvent is null