From 4c3f18f8529ca6f0e22b91e50163b8dcc9f8ea9b Mon Sep 17 00:00:00 2001 From: Julian Arndt Date: Mon, 10 Apr 2023 13:48:04 +0200 Subject: [PATCH] Fix error --- src/main/java/de/jeyp91/apifootball/APIFootballMatch.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java b/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java index 7c7f8d8..2e47aa5 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballMatch.java @@ -77,9 +77,11 @@ public class APIFootballMatch extends BaseMatch { } private void parseResult(JSONObject json) { - String resultFulltime = ((JSONObject) json.get("score")).get("fulltime").toString(); - this.goalsHome = Integer.parseInt(resultFulltime.substring(0, 1)); - this.goalsGuest = Integer.parseInt(resultFulltime.substring(2, 3)); + Object resultFulltime = ((JSONObject) json.get("score")).get("fulltime"); + if(resultFulltime != null) { + this.goalsHome = Integer.parseInt(resultFulltime.toString().substring(0, 1)); + this.goalsGuest = Integer.parseInt(resultFulltime.toString().substring(2, 3)); + } Object resultExtratime = ((JSONObject) json.get("score")).get("extratime"); if(resultExtratime != null) {