From 5c95dec36d13de83cfa1dcaec7ab1482a7677df5 Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Tue, 20 Sep 2022 00:16:45 +0300 Subject: [PATCH] Improve promise handling --- view-train.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/view-train.js b/view-train.js index 12dd02a..f5e1d23 100644 --- a/view-train.js +++ b/view-train.js @@ -316,9 +316,11 @@ function refresh() { } return response.json() }).then(function (response) { + if (!response) { + return + } trainData = response onTrainData(response) - }).then(function () { reschedule() }).catch(function (e) { // Check in 1 second if network error