0

我有一个 IllegalArgumentException 并且不知道如何解决它。

Exception in thread "Display" java.lang.ExceptionInInitializerError
at com.cube.zambezi.graphics.Sprite.<clinit>(Sprite.java:16)
at com.cube.zambezi.level.tile.Tile.<clinit>(Tile.java:15)
at com.cube.zambezi.level.Level.getTile(Level.java:95)
at com.cube.zambezi.level.Level.render(Level.java:71)
at com.cube.zambezi.Game.render(Game.java:172)
at com.cube.zambezi.Game.run(Game.java:142)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
at com.cube.zambezi.graphics.SpriteSheet.load(SpriteSheet.java:34)
at com.cube.zambezi.graphics.SpriteSheet.<init>(SpriteSheet.java:29)
at com.cube.zambezi.graphics.SpriteSheet.<clinit>(SpriteSheet.java:19)
... 7 more

如果您需要更多信息,请告诉我。

4

1 回答 1

0

You are trying to read an image, but your input is null.

Make sure you have a valid input, either from a stream, a file or a URL, and the problem is solved.

If you don't know in advance, a simple if (input != null) around the ImageIO.read will fix it.

于 2013-05-31T09:00:16.667 回答