mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 02:07:12 +00:00
Prevent crash
This commit is contained in:
parent
62a4fba00d
commit
e943593035
1 changed files with 25 additions and 19 deletions
|
@ -30,6 +30,7 @@ import android.net.ConnectivityManager;
|
|||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.BadParcelableException;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.DeadObjectException;
|
||||
|
@ -320,28 +321,33 @@ public class Log {
|
|||
if (data == null)
|
||||
return result;
|
||||
|
||||
Set<String> keys = data.keySet();
|
||||
for (String key : keys) {
|
||||
Object v = data.get(key);
|
||||
try {
|
||||
Set<String> keys = data.keySet();
|
||||
for (String key : keys) {
|
||||
Object v = data.get(key);
|
||||
|
||||
Object value = v;
|
||||
if (v != null && v.getClass().isArray()) {
|
||||
int length = Array.getLength(v);
|
||||
if (length <= 10) {
|
||||
String[] elements = new String[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Object element = Array.get(v, i);
|
||||
if (element instanceof Long)
|
||||
elements[i] = "0x" + Long.toHexString((Long) element);
|
||||
else
|
||||
elements[i] = (element == null ? null : element.toString());
|
||||
Object value = v;
|
||||
if (v != null && v.getClass().isArray()) {
|
||||
int length = Array.getLength(v);
|
||||
if (length <= 10) {
|
||||
String[] elements = new String[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Object element = Array.get(v, i);
|
||||
if (element instanceof Long)
|
||||
elements[i] = "0x" + Long.toHexString((Long) element);
|
||||
else
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue