diff --git a/src/keepass2android/Totp/TrayTotpPluginAdapter.cs b/src/keepass2android/Totp/TrayTotpPluginAdapter.cs index 1aeae561c..d1266cfa9 100644 --- a/src/keepass2android/Totp/TrayTotpPluginAdapter.cs +++ b/src/keepass2android/Totp/TrayTotpPluginAdapter.cs @@ -31,17 +31,8 @@ public TrayTotpHandler(Context ctx, Handler uiThreadHandler, bool muteWarnings) _muteWarnings = muteWarnings; } - /// - /// Check if specified Entry contains Settings that are not null. - /// - internal bool SettingsCheck(IDictionary entryFields) - { - string settings; - entryFields.TryGetValue(SettingsFieldName, out settings); - return !String.IsNullOrEmpty(settings); - } - - internal bool SeedCheck(IDictionary entryFields) + + internal bool HasSeed(IDictionary entryFields) { string seed; entryFields.TryGetValue(SeedFieldName, out seed); @@ -100,15 +91,15 @@ internal bool SettingsValidate(IDictionary entryFields, out bool } private string[] SettingsGet(IDictionary entryFields) - { - return entryFields[SettingsFieldName].Split(';'); - } + { + return entryFields.TryGetValue(SettingsFieldName, out var settings) ? settings.Split(';') : new[] { "30", "6" }; + } public TotpData GetTotpData(IDictionary entryFields) { TotpData res = new TotpData(); - if (SettingsCheck(entryFields) && SeedCheck(entryFields)) + if (HasSeed(entryFields)) { bool ValidInterval; bool ValidLength; bool ValidUrl; if (SettingsValidate(entryFields, out ValidInterval, out ValidLength, out ValidUrl))