Be sure to call callback even on failure

Stephen Paul Weber created

Change summary

src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java | 3 
1 file changed, 2 insertions(+), 1 deletion(-)

Detailed changes

src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java 🔗

@@ -398,7 +398,6 @@ public class HttpDownloadConnection implements Transferable {
                 decryptIfNeeded();
                 finish();
                 updateImageBounds();
-                if (cb != null) cb.accept(file);
             } catch (final SSLHandshakeException e) {
                 changeStatus(STATUS_OFFER);
             } catch (final Exception e) {
@@ -410,6 +409,8 @@ public class HttpDownloadConnection implements Transferable {
                     HttpDownloadConnection.this.mXmppConnectionService.getNotificationService().push(message);
                 }
                 cancel();
+            } finally {
+                if (cb != null) cb.accept(file);
             }
         }