1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 18:27:43 +00:00

Prevent crash

This commit is contained in:
M66B 2019-10-29 07:57:39 +01:00
parent 62a4fba00d
commit e943593035

View file

@ -30,6 +30,7 @@ import android.net.ConnectivityManager;
import android.net.Network; import android.net.Network;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.BadParcelableException;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.DeadObjectException; import android.os.DeadObjectException;
@ -320,28 +321,33 @@ public class Log {
if (data == null) if (data == null)
return result; return result;
Set<String> keys = data.keySet(); try {
for (String key : keys) { Set<String> keys = data.keySet();
Object v = data.get(key); for (String key : keys) {
Object v = data.get(key);
Object value = v; Object value = v;
if (v != null && v.getClass().isArray()) { if (v != null && v.getClass().isArray()) {
int length = Array.getLength(v); int length = Array.getLength(v);
if (length <= 10) { if (length <= 10) {
String[] elements = new String[length]; String[] elements = new String[length];
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Object element = Array.get(v, i); Object element = Array.get(v, i);
if (element instanceof Long) if (element instanceof Long)
elements[i] = "0x" + Long.toHexString((Long) element); elements[i] = "0x" + Long.toHexString((Long) element);
else else
elements[i] = (element == null ? null : element.toString()); elements[i] = (element == null ? null : element.toString());
}
value = TextUtils.join(",", elements);
} }
value = TextUtils.join(",", elements); } else if (v instanceof Long)
} value = "0x" + Long.toHexString((Long) v);
} else if (v instanceof Long)
value = "0x" + Long.toHexString((Long) v);
result.add(key + "=" + value + (value == null ? "" : " (" + v.getClass().getSimpleName() + ")")); result.add(key + "=" + value + (value == null ? "" : " (" + v.getClass().getSimpleName() + ")"));
}
} catch (BadParcelableException ex) {
// android.os.BadParcelableException: ClassNotFoundException when unmarshalling: ...
Log.e(ex);
} }
return result; return result;