fix potential crash when opening from internal cache, closes #1179

This commit is contained in:
Philipp Crocoll
2020-03-09 10:28:44 +01:00
parent e688639f47
commit 349f6c7c90

View File

@@ -1366,11 +1366,9 @@ namespace keepass2android
throw new NullPointerException("cpQuickUnlock");
App.Kp2a.SetQuickUnlockEnabled(cbQuickUnlock.Checked);
if (App.Kp2a.OfflineMode != _loadDbTaskOffline)
if ((_loadDbFileTask != null) && (App.Kp2a.OfflineMode != _loadDbTaskOffline))
{
if (_loadDbFileTask == null)
throw new NullPointerException("_loadDbFileTask");
if (App.Kp2a == null)
if (App.Kp2a == null)
throw new NullPointerException("App.Kp2a");
//keep the loading result if we loaded in online-mode (now offline) and the task is completed
if (!App.Kp2a.OfflineMode || !_loadDbFileTask.IsCompleted)