diff --git a/java/com/google/scrollview/events/SVEventHandler.java b/java/com/google/scrollview/events/SVEventHandler.java index 09913141..26a92bdb 100644 --- a/java/com/google/scrollview/events/SVEventHandler.java +++ b/java/com/google/scrollview/events/SVEventHandler.java @@ -28,6 +28,7 @@ import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; +import java.awt.Window; import javax.swing.Timer; @@ -262,7 +263,10 @@ public class SVEventHandler extends PBasicInputEventHandler implements public void windowClosing(WindowEvent e) { processEvent(new SVEvent(SVEventType.SVET_DESTROY, svWindow, lastXMove, lastYMove, 0, 0, null)); - e.getWindow().dispose(); + Window w = e.getWindow(); + if (w != null) { + w.dispose(); + } SVWindow.nrWindows--; if (SVWindow.nrWindows == 0) { processEvent(new SVEvent(SVEventType.SVET_EXIT, svWindow, lastXMove,