Index: trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 11470)
+++ trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 11472)
@@ -279,9 +279,11 @@
                         command.possiblyInterrupt();
                         for (;;) {
-                            int nBytesRead;
-                            nBytesRead = audioInputStream.read(abData, 0, abData.length);
-                            position += nBytesRead / bytesPerSecond;
+                            int nBytesRead = 0;
+                            if (audioInputStream != null) {
+                                nBytesRead = audioInputStream.read(abData, 0, abData.length);
+                                position += nBytesRead / bytesPerSecond;
+                            }
                             command.possiblyInterrupt();
-                            if (nBytesRead < 0) {
+                            if (nBytesRead < 0 || audioInputStream == null || audioOutputLine == null) {
                                 break;
                             }
@@ -290,6 +292,8 @@
                         }
                         // end of audio, clean up
-                        audioOutputLine.drain();
-                        audioOutputLine.close();
+                        if (audioOutputLine != null) {
+                            audioOutputLine.drain();
+                            audioOutputLine.close();
+                        }
                         audioOutputLine = null;
                         Utils.close(audioInputStream);
