Fix some unfriendly behavior in Favicon#create(Path)
This commit is contained in:
@@ -93,7 +93,11 @@ public final class Favicon {
|
|||||||
*/
|
*/
|
||||||
public static Favicon create(Path path) throws IOException {
|
public static Favicon create(Path path) throws IOException {
|
||||||
try (InputStream stream = Files.newInputStream(path)) {
|
try (InputStream stream = Files.newInputStream(path)) {
|
||||||
return create(ImageIO.read(stream));
|
BufferedImage image = ImageIO.read(stream);
|
||||||
|
if (image == null) {
|
||||||
|
throw new IOException("Unable to read the image.");
|
||||||
|
}
|
||||||
|
return create(image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user