- Timestamp:
- 2017-01-16T23:21:57+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r11397 r11472 279 279 command.possiblyInterrupt(); 280 280 for (;;) { 281 int nBytesRead; 282 nBytesRead = audioInputStream.read(abData, 0, abData.length); 283 position += nBytesRead / bytesPerSecond; 281 int nBytesRead = 0; 282 if (audioInputStream != null) { 283 nBytesRead = audioInputStream.read(abData, 0, abData.length); 284 position += nBytesRead / bytesPerSecond; 285 } 284 286 command.possiblyInterrupt(); 285 if (nBytesRead < 0 ) {287 if (nBytesRead < 0 || audioInputStream == null || audioOutputLine == null) { 286 288 break; 287 289 } … … 290 292 } 291 293 // end of audio, clean up 292 audioOutputLine.drain(); 293 audioOutputLine.close(); 294 if (audioOutputLine != null) { 295 audioOutputLine.drain(); 296 audioOutputLine.close(); 297 } 294 298 audioOutputLine = null; 295 299 Utils.close(audioInputStream);
Note:
See TracChangeset
for help on using the changeset viewer.