From 4ccb1a38bfdf9c43a39e342c1775d89ad016328e Mon Sep 17 00:00:00 2001 From: Balazs Toldi Date: Mon, 29 Jul 2024 21:47:48 +0200 Subject: [PATCH] Fix crash when opening links This commit fixes the issue where opening links while browsing would trigger an account switch with a null name. --- .../infinityforlemmy/activities/LinkResolverActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java index c4271487..22da6766 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java @@ -224,7 +224,7 @@ public class LinkResolverActivity extends AppCompatActivity { intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName); startActivity(intent); } else { - if (mAccountQualifedName == null || !mAccountQualifedName.equals(newAccountName)) { + if (mAccountQualifedName == null || newAccountName != null && !mAccountQualifedName.equals(newAccountName)) { SwitchAccount.switchAccount(mRedditDataRoomDatabase, mRetrofit, mCurrentAccountSharedPreferences, mExecutor, new Handler(), newAccountName, newAccount -> { EventBus.getDefault().post(new SwitchAccountEvent(getClass().getName())); @@ -259,7 +259,7 @@ public class LinkResolverActivity extends AppCompatActivity { } }); } else { - if (mAccountQualifedName == null || !mAccountQualifedName.equals(newAccountName)) { + if (mAccountQualifedName == null || newAccountName != null && !mAccountQualifedName.equals(newAccountName)) { SwitchAccount.switchAccount(mRedditDataRoomDatabase, mRetrofit, mCurrentAccountSharedPreferences, mExecutor, new Handler(), newAccountName, newAccount -> { EventBus.getDefault().post(new SwitchAccountEvent(getClass().getName()));