Skip to content

Commit

Permalink
Proposed fix for microsoft#2780. (microsoft#2786)
Browse files Browse the repository at this point in the history
Thank you for your submission
  • Loading branch information
CXuesong authored and JasonSowers committed Oct 20, 2017
1 parent 135224c commit 247a411
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CSharp/Samples/AnnotatedSandwichBot/AnnotatedSandwich.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static IForm<SandwichOrder> BuildForm()
.Field(nameof(Toppings),
validate: async (state, value) =>
{
var values = ((List<object>)value).OfType<ToppingOptions>();
var values = ((List<object>)value)?.OfType<ToppingOptions>();
var result = new ValidateResult { IsValid = true, Value = values };
if (values != null && values.Contains(ToppingOptions.Everything))
{
Expand Down Expand Up @@ -288,7 +288,7 @@ public static IForm<SandwichOrder> BuildLocalizedForm()
.Field(nameof(Toppings),
validate: async (state, value) =>
{
var values = ((List<object>)value).OfType<ToppingOptions>();
var values = ((List<object>)value)?.OfType<ToppingOptions>();
var result = new ValidateResult { IsValid = true, Value = values };
if (values != null && values.Contains(ToppingOptions.Everything))
{
Expand Down

0 comments on commit 247a411

Please sign in to comment.