From 6b4fd9f11a2c9376cfcd75b36ca5e313fee0075f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Panadero?= Date: Mon, 8 Apr 2019 13:20:00 +0200 Subject: [PATCH] Fixed #158: Resources thrown when the application is killed by OS --- src/android/Fingerprint.java | 4 ++++ src/android/FingerprintAuthenticationDialogFragment.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/android/Fingerprint.java b/src/android/Fingerprint.java index 32fd67c0..a6b69c6a 100644 --- a/src/android/Fingerprint.java +++ b/src/android/Fingerprint.java @@ -433,4 +433,8 @@ public static boolean setPluginResultError(String errorMessage) { mPluginResult = new PluginResult(PluginResult.Status.ERROR); return false; } + + public static boolean isPluginSetUp() { + return Fingerprint.packageName != null; + } } \ No newline at end of file diff --git a/src/android/FingerprintAuthenticationDialogFragment.java b/src/android/FingerprintAuthenticationDialogFragment.java index 54fb28d4..b153f2b4 100644 --- a/src/android/FingerprintAuthenticationDialogFragment.java +++ b/src/android/FingerprintAuthenticationDialogFragment.java @@ -78,6 +78,12 @@ public void onCreate(Bundle savedInstanceState) { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + if (!Fingerprint.isPluginSetUp()) { + Log.i(TAG, "Invalid state, view not created"); + dismissAllowingStateLoss(); + return null; + } + Bundle args = getArguments(); disableBackup = args.getBoolean("disableBackup"); Log.d(TAG, "disableBackup: " + disableBackup);