Permalink
Browse files

Added extra error message when resource stream is not opened.

  • Loading branch information...
1 parent df63c6a commit df1ed35c283e7b44797b8bfb60d924d0cfa9ccd5 @finnkuusisto committed Apr 8, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/kuusisto/tinysound/TinySound.java
  2. BIN tinysound.zip
@@ -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);
}
@@ -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);
}
View
Binary file not shown.

0 comments on commit df1ed35

Please sign in to comment.