Skip to content

Commit

Permalink
PlayWavFile: check for null InputStream before creating the buffered …
Browse files Browse the repository at this point in the history
…version. Fixes Eclipse cannot be null warning.
  • Loading branch information
llongi committed Dec 7, 2017
1 parent 4e1b196 commit 3863ece
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/net/sf/jaer/util/PlayWavFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ public PlayWavFile(String wavfile, Position p) {
/**
* This method plays the file. Start the thread to play.
*/
public void run() {
@Override
public void run() {

BufferedInputStream is = null;
File soundFile = new File(filename);
try {
is = new BufferedInputStream(new FileInputStream(soundFile));
is = new BufferedInputStream(new FileInputStream(new File(filename)));
} catch (FileNotFoundException e) {
is = new BufferedInputStream(getClass().getResourceAsStream(filename));
if (is == null) {
final InputStream s = getClass().getResourceAsStream(filename);
if (s == null) {
log.warning("Wave file not found on filesystem or classpath: " + filename);
return;
}

is = new BufferedInputStream(s);
}

AudioInputStream audioInputStream = null;
Expand Down

0 comments on commit 3863ece

Please sign in to comment.