From 120ddcf8c95d4751b5c837e39aa9e3f908910f74 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 14 Dec 2017 12:25:21 +0100 Subject: [PATCH] fixed treatAsDownload() for empty messages --- src/main/java/eu/siacs/conversations/entities/Message.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 1335d4bc2..42c7a4740 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -726,10 +726,14 @@ public class Message extends AbstractEntity { if (treatAsDownloadable == null) { try { final String[] lines = body.split("\n"); + if (lines.length ==0) { + treatAsDownloadable = false; + return false; + } for(String line : lines) { if (line.contains("\\s+")) { treatAsDownloadable = false; - return treatAsDownloadable; + return false; } } final URL url = new URL(lines[0]);