Commit e72cbd0b authored by Tiago Cunha's avatar Tiago Cunha

Fixes NPE

parent 978b39bd
...@@ -72,7 +72,11 @@ public class Avatar { ...@@ -72,7 +72,11 @@ public class Avatar {
//from Rocket.Chat:packages/rocketchat-ui/lib/avatar.coffee //from Rocket.Chat:packages/rocketchat-ui/lib/avatar.coffee
//REMARK! this is often SVG image! (see: Rocket.Chat:server/startup/avatar.coffee) //REMARK! this is often SVG image! (see: Rocket.Chat:server/startup/avatar.coffee)
try { try {
return absoluteUrl.getAbsolute("/avatar/" + URLEncoder.encode(username, "UTF-8") + ".jpg"); final String avatarUrl = "/avatar/" + URLEncoder.encode(username, "UTF-8") + ".jpg";
if (absoluteUrl == null) {
return avatarUrl;
}
return absoluteUrl.getAbsolute(avatarUrl);
} catch (UnsupportedEncodingException exception) { } catch (UnsupportedEncodingException exception) {
RCLog.e(exception, "failed to get URL for user: %s", username); RCLog.e(exception, "failed to get URL for user: %s", username);
return null; return null;
......
...@@ -239,6 +239,9 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout { ...@@ -239,6 +239,9 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
} }
private String absolutize(String url) { private String absolutize(String url) {
if (absoluteUrl == null) {
return url;
}
return absoluteUrl.getAbsolute(url); return absoluteUrl.getAbsolute(url);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment