diff --git a/src/Generator/Types/Std/Stdlib.CLI.cs b/src/Generator/Types/Std/Stdlib.CLI.cs index ccb98ec0..7edb6bbc 100644 --- a/src/Generator/Types/Std/Stdlib.CLI.cs +++ b/src/Generator/Types/Std/Stdlib.CLI.cs @@ -201,10 +201,10 @@ namespace CppSharp.Types.Std.CLI ? new CILType(typeof(nint)) : type.Type; - ctx.Before.WriteLineIndent("if (!{0}.has_value())", ctx.ArgName); + ctx.Before.WriteLine("if (!{0}.has_value())", ctx.ReturnVarName); { - ctx.Before.WriteLine("return {};"); - ctx.Before.Unindent(); + ctx.Before.WriteLineIndent("return {};"); + ctx.Before.NewLine(); } var elementCtx = new MarshalContext(ctx.Context, ctx.Indentation)