mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-11 19:08:00 -04:00
Prevent NullPointerException in onBackPressed
This crash seems to somehow only happen on Huawei and Xiaomi devices. While fairly rare, it is the most common Catima crash currently logged on Google Play Console (8 crashes over the last 28 days). While I don't understand how this would happen, I think it should be relatively safe to assume that if the searchview is null the user isn't currently searching so running the normal back code should always be the expected behaviour.
This commit is contained in:
@@ -425,7 +425,7 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (!mSearchView.isIconified()) {
|
||||
if (mSearchView != null && !mSearchView.isIconified()) {
|
||||
mSearchView.setIconified(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user