Skip to content

Commit

Permalink
Added extra error message when resource stream is not opened.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnkuusisto committed Apr 8, 2012
1 parent df63c6a commit df1ed35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/kuusisto/tinysound/TinySound.java
Expand Up @@ -157,6 +157,11 @@ public static Music loadMusic(String name) {
name = "/" + name;
}
InputStream stream = TinySound.class.getResourceAsStream(name);
//check for failure to find resource
if (stream == null) {
System.err.println("Unable to find resource " + name + "!");
return null;
}
return TinySound.loadMusic(stream);
}

Expand Down Expand Up @@ -261,6 +266,11 @@ public static Sound loadSound(String name) {
name = "/" + name;
}
InputStream stream = TinySound.class.getResourceAsStream(name);
//check for failure to find resource
if (stream == null) {
System.err.println("Unable to find resource " + name + "!");
return null;
}
return TinySound.loadSound(stream);

}
Expand Down
Binary file modified tinysound.zip
Binary file not shown.

0 comments on commit df1ed35

Please sign in to comment.