Browse Source

Improved null handling when marshaling CLI strings.

pull/608/head
Joao Matos 10 years ago
parent
commit
df3f26d0aa
  1. 4
      src/Generator/Generators/CLI/CLIMarshal.cs

4
src/Generator/Generators/CLI/CLIMarshal.cs

@ -180,7 +180,9 @@ namespace CppSharp.Generators.CLI @@ -180,7 +180,9 @@ namespace CppSharp.Generators.CLI
throw new NotSupportedException(string.Format("{0} is not supported yet.",
Context.Driver.Options.Encoding.EncodingName));
return string.Format("clix::marshalString<clix::{1}>({0})", varName, param);
return string.Format(
"({0} == 0 ? nullptr : clix::marshalString<clix::{1}>({0}))",
varName, param);
}
public override bool VisitMemberPointerType(MemberPointerType member,

Loading…
Cancel
Save