autofill: avoid crash when looking up a null key.

closes https://github.com/PhilippC/keepass2android/issues/2362
This commit is contained in:
Philipp Crocoll
2025-03-11 16:11:35 +01:00
parent d2e0ae6394
commit 07f08a8851

View File

@@ -445,6 +445,9 @@ namespace Kp2aAutofillParser
public static string ToCanonicalHint(string hint)
{
//avoid crash when looking up a null key
if (hint == null)
return "";
string canonicalHint;
if (!hintToCanonicalReplacement.TryGetValue(hint, out canonicalHint))
canonicalHint = hint;
@@ -841,6 +844,7 @@ namespace Kp2aAutofillParser
continue;
if (viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any())
{
AddFieldToHintMap(viewNode, viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray());
}