aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java3
-rw-r--r--src/main/java/eu/siacs/conversations/utils/FileUtils.java2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 12127ecc..184d7e56 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -470,6 +470,9 @@ public class Message extends AbstractEntity {
}
private String extractRelevantExtension(URL url) {
+ if (url == null) {
+ return null;
+ }
String path = url.getPath();
return extractRelevantExtension(path);
}
diff --git a/src/main/java/eu/siacs/conversations/utils/FileUtils.java b/src/main/java/eu/siacs/conversations/utils/FileUtils.java
index 727891ae..7c2a51c5 100644
--- a/src/main/java/eu/siacs/conversations/utils/FileUtils.java
+++ b/src/main/java/eu/siacs/conversations/utils/FileUtils.java
@@ -167,7 +167,7 @@ public class FileUtils {
final int lastDotPosition = filename.lastIndexOf('.');
final int secondToLastDotPosition = filename.lastIndexOf('.', lastDotPosition - 1);
final String secondToLastPart = secondToLastDotPosition != -1 ?
- filename.substring(secondToLastDotPosition + 1, lastDotPosition - 1) : "";
+ filename.substring(secondToLastDotPosition + 1, lastDotPosition) : "";
return secondToLastPart;
}
}