Commit 9b8ae5be authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Variable absoluteUrl can be null (this avoid app crashing)

parent e814e74d
...@@ -4,13 +4,17 @@ import chat.rocket.android.widget.AbsoluteUrl ...@@ -4,13 +4,17 @@ import chat.rocket.android.widget.AbsoluteUrl
import chat.rocket.android.widget.RocketChatAvatar import chat.rocket.android.widget.RocketChatAvatar
import java.net.URLEncoder import java.net.URLEncoder
class Avatar(val absoluteUrl: AbsoluteUrl, val username: String) { class Avatar(val absoluteUrl: AbsoluteUrl?, val username: String) {
val imageUrl: String val imageUrl: String
/** REMARK /** REMARK
* This is often a SVG image (see Rocket.Chat:server/startup/avatar.js) * This is often a SVG image (see Rocket.Chat:server/startup/avatar.js)
*/ */
get() { get() {
val avatarUrl = "/avatar/" + URLEncoder.encode(username, "UTF-8")
if (absoluteUrl == null) {
return avatarUrl
}
return absoluteUrl.from("/avatar/" + URLEncoder.encode(username, "UTF-8")) return absoluteUrl.from("/avatar/" + URLEncoder.encode(username, "UTF-8"))
} }
......
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