fix potential crashes when database has been closed and recreating activities

This commit is contained in:
Philipp Crocoll
2019-03-28 04:42:24 +01:00
parent 016864edfc
commit ad4c764adb
2 changed files with 7 additions and 8 deletions

View File

@@ -189,13 +189,12 @@ namespace keepass2android
PwUuid id = RetrieveGroupId (intent);
Database db = App.Kp2a.CurrentDb;
if (id == null) {
Group = db.Root;
} else {
Group = db.GroupsById[id];
}
Log.Warn (Tag, "Retrieved group");
if (db != null)
{
Group = id == null ? db.Root : db.GroupsById[id];
}
Log.Warn (Tag, "Retrieved group");
if (Group == null) {
Log.Warn (Tag, "Group was null");
return;

View File

@@ -65,7 +65,7 @@ namespace keepass2android
Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
}
_ioc = App.Kp2a.GetDbForQuickUnlock().Ioc;
_ioc = App.Kp2a.GetDbForQuickUnlock()?.Ioc;
if (_ioc == null)
{