Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[UWP] Protect InputScope InvalidCastException #13618

Merged
merged 2 commits into from
Jan 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Xamarin.Forms.Platform.UAP/KeyboardExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static InputScope ToInputScope(this Keyboard self)
{
name.NameValue = InputScopeNameValue.Url;
}
else
else if (self is CustomKeyboard)
{
var custom = (CustomKeyboard)self;
var capitalizedSentenceEnabled = (custom.Flags & KeyboardFlags.CapitalizeSentence) == KeyboardFlags.CapitalizeSentence;
Expand Down Expand Up @@ -77,6 +77,11 @@ public static InputScope ToInputScope(this Keyboard self)

name.NameValue = nameValue;
}
else
{
// Should never happen
name.NameValue = InputScopeNameValue.Default;
}

result.Names.Add(name);
return result;
Expand Down