From fbf2d72f5decd5498b2345a001b4be480432c4d5 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 16 Jan 2024 10:16:27 +0100 Subject: [PATCH] Fix a crash with wrong Serialization --- .../mastodon/client/entities/app/CachedBundle.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/CachedBundle.java b/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/CachedBundle.java index e9494fb2..6d34fb91 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/CachedBundle.java +++ b/app/src/main/java/app/fedilab/android/mastodon/client/entities/app/CachedBundle.java @@ -106,7 +106,10 @@ public class CachedBundle { if (bundle.containsKey(Helper.ARG_ACCOUNT) && currentUser != null) { ContentValues valuesAccount = new ContentValues(); 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) { bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account); valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount)); @@ -122,7 +125,10 @@ public class CachedBundle { if (bundle.containsKey(Helper.ARG_STATUS) && currentUser != null) { ContentValues valuesAccount = new ContentValues(); 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) { bundleStatus.putSerializable(Helper.ARG_STATUS, status); valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleStatus));