Fix a crash with wrong Serialization

This commit is contained in:
Thomas 2024-01-16 10:16:27 +01:00
parent 169b00af30
commit fbf2d72f5d

View file

@ -106,7 +106,10 @@ public class CachedBundle {
if (bundle.containsKey(Helper.ARG_ACCOUNT) && currentUser != null) { if (bundle.containsKey(Helper.ARG_ACCOUNT) && currentUser != null) {
ContentValues valuesAccount = new ContentValues(); ContentValues valuesAccount = new ContentValues();
Bundle bundleAccount = new Bundle(); Bundle bundleAccount = new Bundle();
Account account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT); Account account = null;
try {
account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}catch (ClassCastException ignored){}
if (account != null) { if (account != null) {
bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account); bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount)); valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount));
@ -122,7 +125,10 @@ public class CachedBundle {
if (bundle.containsKey(Helper.ARG_STATUS) && currentUser != null) { if (bundle.containsKey(Helper.ARG_STATUS) && currentUser != null) {
ContentValues valuesAccount = new ContentValues(); ContentValues valuesAccount = new ContentValues();
Bundle bundleStatus = new Bundle(); Bundle bundleStatus = new Bundle();
Status status = (Status) bundle.getSerializable(Helper.ARG_STATUS); Status status = null;
try {
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}catch (ClassCastException ignored){}
if (status != null) { if (status != null) {
bundleStatus.putSerializable(Helper.ARG_STATUS, status); bundleStatus.putSerializable(Helper.ARG_STATUS, status);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleStatus)); valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleStatus));