aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/eu/olli
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2020-07-05 22:12:42 +0200
committerCow <cow@volloeko.de>2020-07-05 22:12:42 +0200
commitc07908279ef2d4659eee4b7710df1af1ae107569 (patch)
treeae9bd2042d3cb349d22d60d6eca93cdb9e32fd49 /src/main/java/eu/olli
parent7895f9c0ffe467c449ab4b2e5285b5395ef245f2 (diff)
downloadCowlection-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.java4
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);