koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
360 stars 65 forks source link

Java - AbstractL4DStats throws NullPointerException when no recent game exists. #62

Closed mlegenhausen closed 14 years ago

mlegenhausen commented 14 years ago

When the parsed XML document contains:

<mostrecentgame>
</mostrecentgame>

Then a NullPointerException is thrown cause there is no check in the constructor if there is any most recent game.

Stacktrace:
Exception in thread "main" java.lang.NullPointerException
at steamcondenser.steam.community.l4d.AbstractL4DStats.<init>(AbstractL4DStats.java:57)
at steamcondenser.steam.community.l4d.L4D2Stats.<init>(L4D2Stats.java:31)
at steamcondenser.steam.community.GameStats.createGameStats(GameStats.java:65)
at steamcondenser.steam.community.SteamId.getGameStats(SteamId.java:398)
at steam.SteamTest.getGames(SteamTest.java:36)
at steam.SteamTest.main(SteamTest.java:55)
mlegenhausen commented 14 years ago

Same occurs in L4DStats too. I currently solve the problem by checking if mostRecentGameNode != null.

koraktor commented 14 years ago

Java: Fixed NPE in constructor of AbstractL4DStats

Closed by 7c2accd638ff52ab9a183166a671505690a5dfd8