diff options
author | Cow <cow@volloeko.de> | 2020-07-05 22:12:42 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2020-07-05 22:12:42 +0200 |
commit | c07908279ef2d4659eee4b7710df1af1ae107569 (patch) | |
tree | ae9bd2042d3cb349d22d60d6eca93cdb9e32fd49 /src/main/java/eu/olli | |
parent | 7895f9c0ffe467c449ab4b2e5285b5395ef245f2 (diff) | |
download | Cowlection-c07908279ef2d4659eee4b7710df1af1ae107569.tar.gz Cowlection-c07908279ef2d4659eee4b7710df1af1ae107569.tar.bz2 Cowlection-c07908279ef2d4659eee4b7710df1af1ae107569.zip |
Fixed NPE
- caused by an empty friends file on 2nd+ launch
Diffstat (limited to 'src/main/java/eu/olli')
-rw-r--r-- | src/main/java/eu/olli/cowlection/handler/FriendsHandler.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/eu/olli/cowlection/handler/FriendsHandler.java b/src/main/java/eu/olli/cowlection/handler/FriendsHandler.java index a51fcd4..27e4a3a 100644 --- a/src/main/java/eu/olli/cowlection/handler/FriendsHandler.java +++ b/src/main/java/eu/olli/cowlection/handler/FriendsHandler.java @@ -153,7 +153,9 @@ public class FriendsHandler { this.bestFriends.clear(); if (!createdNewFile) { String bestFriendsData = FileUtils.readFileToString(this.bestFriendsFile, StandardCharsets.UTF_8); - this.bestFriends.addAll(parseJson(bestFriendsData)); + if (bestFriendsData.length() > 0) { + this.bestFriends.addAll(parseJson(bestFriendsData)); + } } } catch (IOException e) { main.getLogger().error("Couldn't read best friends file " + this.bestFriendsFile, e); |