Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit d021a97

Browse files
kunall17niftynei
authored andcommitted
Create blank drawable if no emoji present
1 parent a5149c0 commit d021a97

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/src/main/java/com/zulip/android/models/Message.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
import org.json.JSONObject;
1919

2020
import android.content.Context;
21+
import android.graphics.Color;
22+
import android.graphics.Rect;
23+
import android.graphics.drawable.ColorDrawable;
2124
import android.graphics.drawable.Drawable;
2225
import android.text.Html;
2326
import android.text.Spanned;
@@ -491,6 +494,12 @@ public Drawable getDrawable(String source) {
491494
Drawable drawable = Drawable.createFromStream(context
492495
.getAssets().open("emoji/" + filename),
493496
"emoji/" + filename);
497+
if (drawable == null) {
498+
Drawable transparentDrawable = new ColorDrawable(Color.TRANSPARENT);
499+
transparentDrawable.setBounds(new Rect(0, 0, 0, 0));
500+
return transparentDrawable;
501+
}
502+
494503
// scaling down by half to fit well in message
495504
double scaleFactor = 0.5;
496505
drawable.setBounds(0, 0,

0 commit comments

Comments
 (0)