From 3ee90ac6c69d6204523bc45ced6a45c46cee9dfd Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 14 Feb 2018 10:47:43 -0800 Subject: [PATCH] Reorder clause to prevent null pointer exception when response is null and try_again is true --- .../kotlin/de/fabianonline/telegram_backup/DownloadManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt b/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt index aae5757..42ca76a 100644 --- a/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt +++ b/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt @@ -450,7 +450,7 @@ class DownloadManager(internal var client: TelegramClient?, p: DownloadProgressI } catch (e: InterruptedException) { } - } while (offset < size && (response!!.getBytes().getData().size > 0 || try_again)) + } while (offset < size && (try_again || response!!.getBytes().getData().size > 0)) fos.close() if (offset < size) { System.out.println("Requested file $target with $size bytes, but got only $offset bytes.")