Prevent crash

This commit is contained in:
M66B 2021-08-17 14:21:08 +02:00
parent 3096f4c471
commit 545d4664ae
3 changed files with 9 additions and 7 deletions

View File

@ -5272,7 +5272,7 @@ class Core {
groupNotifying.put(group, new ArrayList<>());
if (id > 0) {
EntityLog.log(context, null, null, null, id,
EntityLog.log(context, EntityLog.Type.Notification, null, null, id,
"Notify restore " + tag + " id=" + id);
groupNotifying.get(group).add(id);
}

View File

@ -2250,6 +2250,8 @@ public abstract class DB extends RoomDatabase {
@TypeConverter
public static int fromLogType(EntityLog.Type type) {
if (type == null)
type = EntityLog.Type.General;
return type.ordinal();
}
}

View File

@ -71,27 +71,27 @@ public class EntityLog {
log(context, Type.General, data);
}
static void log(final Context context, Type type, EntityAccount account, String data) {
static void log(final Context context, @NonNull Type type, EntityAccount account, String data) {
log(context, type, account.id, null, null, account.name + " " + data);
}
static void log(final Context context, Type type, EntityAccount account, EntityFolder folder, String data) {
static void log(final Context context, @NonNull Type type, EntityAccount account, EntityFolder folder, String data) {
log(context, type, account.id, folder.id, null, account.name + "/" + folder.name + " " + data);
}
static void log(final Context context, Type type, EntityFolder folder, String data) {
static void log(final Context context, @NonNull Type type, EntityFolder folder, String data) {
log(context, type, folder.account, folder.id, null, folder.name + " " + data);
}
static void log(final Context context, Type type, EntityMessage message, String data) {
static void log(final Context context, @NonNull Type type, EntityMessage message, String data) {
log(context, type, message.account, message.folder, message.id, data);
}
static void log(final Context context, Type type, String data) {
static void log(final Context context, @NonNull Type type, String data) {
log(context, type, null, null, null, data);
}
static void log(final Context context, Type type, Long account, Long folder, Long message, String data) {
static void log(final Context context, @NonNull Type type, Long account, Long folder, Long message, String data) {
Log.i(data);
if (context == null)