From 64928d0ff12521bac2805a0e04e1ee0d6c74ace6 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 11 Feb 2018 17:54:59 +0100 Subject: [PATCH] http upload: do not crash on invalid slot responses --- .../conversations/http/HttpUploadConnection.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java index e7e612242..6ceb4ae5e 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java @@ -145,11 +145,11 @@ public class HttpUploadConnection implements Transferable { } } } + if (!canceled) { + new Thread(this::upload).start(); + } + return; } - if (!canceled) { - new Thread(this::upload).start(); - } - return; } catch (MalformedURLException e) { //fall through } @@ -229,7 +229,9 @@ public class HttpUploadConnection implements Transferable { if (connection != null) { connection.disconnect(); } - wakeLock.release(); + if (wakeLock.isHeld()) { + wakeLock.release(); + } } } }