aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-04-12 21:16:26 +0200
committerChristian Schneppe <christian@pix-art.de>2019-04-12 21:16:26 +0200
commit39faf1736756aa31222a4e621d16c18851361d31 (patch)
tree528d03bcd7eaf821ee9aceb069b9168cd7d9aa95 /src/main/java/de/pixart/messenger/utils
parente7a54fb663fe7f66082c88aae6bb9baf9d042639 (diff)
fix some NPE
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils')
-rw-r--r--src/main/java/de/pixart/messenger/utils/RichPreview.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/RichPreview.java b/src/main/java/de/pixart/messenger/utils/RichPreview.java
index e0bff1cf2..10e10b033 100644
--- a/src/main/java/de/pixart/messenger/utils/RichPreview.java
+++ b/src/main/java/de/pixart/messenger/utils/RichPreview.java
@@ -19,8 +19,10 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLEncoder;
import java.util.Calendar;
import java.util.Date;
import java.util.regex.Pattern;
@@ -134,7 +136,11 @@ public class RichPreview {
} catch (URISyntaxException e) {
e.printStackTrace();
}
- base_uri = base_uri != null ? base_uri.resolve(part) : null;
+ try {
+ base_uri = base_uri != null ? base_uri.resolve(URLEncoder.encode(part, "UTF-8")) : null;
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
return base_uri != null ? base_uri.toString() : null;
}
}