Author: Adam Pioterek <adam.pioterek@protonmail.ch>
bugfix: stop is null when refreshing from full favourite
app/src/main/java/ml/adamsprogs/bimba/VmClient.kt | 6 +++++-
diff --git a/app/src/main/java/ml/adamsprogs/bimba/VmClient.kt b/app/src/main/java/ml/adamsprogs/bimba/VmClient.kt index 28072c8281dfc11d353fdc143d7c21b7341256bb..722abb0f13258d53eaab9b684a845b1376b4d49a 100644 --- a/app/src/main/java/ml/adamsprogs/bimba/VmClient.kt +++ b/app/src/main/java/ml/adamsprogs/bimba/VmClient.kt @@ -29,6 +29,10 @@ return } val stopSymbol = intent.getStringExtra(EXTRA_STOP_SYMBOL) + if (stopSymbol == null) { + sendNullResult(requester) + return + } val lineNumber = intent.getStringExtra(EXTRA_LINE_NUMBER) val client = OkHttpClient() @@ -41,6 +45,7 @@ val request = Request.Builder() .url(url) .post(formBody) .build() + val responseBody: String? try { responseBody = client.newCall(request).execute().body()?.string() @@ -64,7 +69,6 @@ for (time in times) { val t = time as Map<*, *> if (lineNumber == null || t["line"] == lineNumber) { val departureDay = (t["departure"] as String).split("T")[0].split("-")[2] - val departureTimeRaw = (t["departure"] as String).split("T")[1].split(":") val departureTime = "${departureTimeRaw[0]}:${departureTimeRaw[1]}" val departure = Departure(t["line"] as String, todayMode, departureTime, false,