Fix NullPointerException in Utils.parseInlineEmotes.

This commit is contained in:
Docile-Alligator 2022-04-23 21:36:25 +08:00
parent 05e9b8b36e
commit 3fa86984dc

View File

@ -190,6 +190,7 @@ public final class Utils {
public static String parseInlineEmotes(String markdown, JSONObject mediaMetadataObject) throws JSONException {
JSONArray mediaMetadataNames = mediaMetadataObject.names();
if (mediaMetadataNames != null) {
for (int i = 0; i < mediaMetadataNames.length(); i++) {
if (!mediaMetadataNames.isNull(i)) {
String mediaMetadataKey = mediaMetadataNames.getString(i);
@ -216,6 +217,7 @@ public final class Utils {
markdown = markdown.replace("![img](" + emote_id + ")", "[" + emote_type + "](" + emote_url + ") ");
}
}
}
return markdown;
}