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

Commit 6442c73

Browse files
Sam1301kunall17
authored andcommitted
Check for person null in startSpan.
1 parent d5401f5 commit 6442c73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,18 @@ private static void endFont(SpannableStringBuilder text) {
244244
}
245245

246246
private static void startSpan(SpannableStringBuilder text, Attributes attributes) {
247-
String email;
247+
String email = null;
248248
String stringId = attributes.getValue("data-user-id");
249249
if (stringId != null) {
250250
// in case of "@all"
251251
if (stringId.equals("*")) {
252252
email = stringId;
253253
} else {
254254
int id = Integer.parseInt(stringId);
255-
email = Person.getById(ZulipApp.get(), id).getEmail();
255+
Person person = Person.getById(ZulipApp.get(), id);
256+
if (person != null) {
257+
email = person.getEmail();
258+
}
256259
}
257260
} else {
258261
// for historical messages, revert to use of this attribute

0 commit comments

Comments
 (0)