Commit e72cbd0b authored by Tiago Cunha's avatar Tiago Cunha

Fixes NPE

parent 978b39bd
......@@ -72,7 +72,11 @@ public class Avatar {
//from Rocket.Chat:packages/rocketchat-ui/lib/avatar.coffee
//REMARK! this is often SVG image! (see: Rocket.Chat:server/startup/avatar.coffee)
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) {
RCLog.e(exception, "failed to get URL for user: %s", username);
return null;
......
......@@ -239,6 +239,9 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
}
private String absolutize(String url) {
if (absoluteUrl == null) {
return 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