Skip to content

Commit 9bbe7f0

Browse files
authored
Fixed mismatch of nullable types (#449)
1 parent bc0e8ae commit 9bbe7f0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

source/UIDataCodeGen/CodeGen/InstantiatorGeneratorBase.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,17 +2914,15 @@ bool GenerateCompositionEffectBrushFactory(CodeBuilder builder, CompositionEffec
29142914
IEnumerable<CompositionEffectSourceParameter> sources = effect.Type switch
29152915
{
29162916
Mgce.GraphicsEffectType.CompositeEffect => ((Mgce.CompositeEffect)effect).Sources,
2917-
Mgce.GraphicsEffectType.GaussianBlurEffect => new[] { ((Mgce.GaussianBlurEffect)effect).Source },
2917+
Mgce.GraphicsEffectType.GaussianBlurEffect => ((Mgce.GaussianBlurEffect)effect).Source is not null ?
2918+
new[] { ((Mgce.GaussianBlurEffect)effect).Source! } : Enumerable.Empty<CompositionEffectSourceParameter>(),
29182919
_ => throw new InvalidOperationException(),
29192920
};
29202921

29212922
// Perform brush initialization.
29222923
foreach (var source in sources)
29232924
{
2924-
if (source is not null)
2925-
{
2926-
builder.WriteLine($"result{Deref}SetSourceParameter({String(source.Name)}, {CallFactoryFromFor(node, obj.GetSourceParameter(source.Name))});");
2927-
}
2925+
builder.WriteLine($"result{Deref}SetSourceParameter({String(source.Name)}, {CallFactoryFromFor(node, obj.GetSourceParameter(source.Name))});");
29282926
}
29292927

29302928
WriteCompositionObjectFactoryEnd(builder, obj, node);

0 commit comments

Comments
 (0)