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

Commit 0b97d89

Browse files
Sam1301kunall17
authored andcommitted
Fix: Crash on @-mention "all" in message.
In case of @-mention "all", the data-user-id field has value "*".
1 parent 2d4006e commit 0b97d89

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/src/main/java/com/zulip/android/util/CustomHtmlToSpannedConverter.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
import java.util.List;
7272
import java.util.Locale;
7373

74+
import static android.R.attr.id;
75+
7476
public class CustomHtmlToSpannedConverter implements ContentHandler {
7577

7678
private static final float[] HEADER_SIZES = {1.5f, 1.4f, 1.3f, 1.2f, 1.1f,
@@ -245,8 +247,13 @@ private static void startSpan(SpannableStringBuilder text, Attributes attributes
245247
String email;
246248
String stringId = attributes.getValue("data-user-id");
247249
if (stringId != null) {
248-
int id = Integer.parseInt(stringId);
249-
email = Person.getById(ZulipApp.get(), id).getEmail();
250+
// in case of "@all"
251+
if (stringId.equals("*")) {
252+
email = stringId;
253+
} else {
254+
int id = Integer.parseInt(stringId);
255+
email = Person.getById(ZulipApp.get(), id).getEmail();
256+
}
250257
} else {
251258
// for historical messages, revert to use of this attribute
252259
email = attributes.getValue("data-user-email");

0 commit comments

Comments
 (0)