autofill: avoid crash when looking up a null key.
closes https://github.com/PhilippC/keepass2android/issues/2362
This commit is contained in:
		| @@ -445,6 +445,9 @@ namespace Kp2aAutofillParser | |||||||
|  |  | ||||||
|         public static string ToCanonicalHint(string hint) |         public static string ToCanonicalHint(string hint) | ||||||
|         { |         { | ||||||
|  |             //avoid crash when looking up a null key | ||||||
|  |             if (hint == null) | ||||||
|  |                 return ""; | ||||||
|             string canonicalHint; |             string canonicalHint; | ||||||
|             if (!hintToCanonicalReplacement.TryGetValue(hint, out canonicalHint)) |             if (!hintToCanonicalReplacement.TryGetValue(hint, out canonicalHint)) | ||||||
|                 canonicalHint = hint; |                 canonicalHint = hint; | ||||||
| @@ -841,6 +844,7 @@ namespace Kp2aAutofillParser | |||||||
|                         continue; |                         continue; | ||||||
|                     if (viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any()) |                     if (viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any()) | ||||||
|                     { |                     { | ||||||
|  |  | ||||||
|                         AddFieldToHintMap(viewNode, viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray()); |                         AddFieldToHintMap(viewNode, viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray()); | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll