Fixed reply to messages without sender

pull/12/head
M66B 6 years ago
parent 1240b29404
commit 8c1ad78caf

@ -176,21 +176,22 @@ public class MessageHelper {
static Address[] decodeAddresses(String json) { static Address[] decodeAddresses(String json) {
List<Address> result = new ArrayList<>(); List<Address> result = new ArrayList<>();
try { if (json != null)
JSONArray jaddresses = new JSONArray(json); try {
for (int i = 0; i < jaddresses.length(); i++) { JSONArray jaddresses = new JSONArray(json);
JSONObject jaddress = (JSONObject) jaddresses.get(i); for (int i = 0; i < jaddresses.length(); i++) {
if (jaddress.has("personal")) JSONObject jaddress = (JSONObject) jaddresses.get(i);
result.add(new InternetAddress( if (jaddress.has("personal"))
jaddress.getString("address"), result.add(new InternetAddress(
jaddress.getString("personal"))); jaddress.getString("address"),
else jaddress.getString("personal")));
result.add(new InternetAddress( else
jaddress.getString("address"))); result.add(new InternetAddress(
jaddress.getString("address")));
}
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
} }
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
}
return result.toArray(new Address[0]); return result.toArray(new Address[0]);
} }

Loading…
Cancel
Save