Skip to content

Commit

Permalink
ToPrimitiveType fix (#4)
Browse files Browse the repository at this point in the history
* Added null handler

* Update Property.cs
  • Loading branch information
tbm0115 authored Mar 30, 2023
1 parent 7368b52 commit 67d7087
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MtconnectTranspiler.Sinks.CSharp/Models/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Property(XmiDocument model, UmlProperty source) : base(model, source)

AccessModifier = source.Visibility;

Type = ScribanHelperMethods.ToPrimitiveType(model, source)?.Name;
Type = ScribanHelperMethods.ToPrimitiveType(model, source)?.Name ?? "object";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public static Type ToPrimitiveType(UmlDataType source)
public static Type ToPrimitiveType(Xmi.XmiDocument model, UmlProperty source)
{
var umlDataType = model.LookupDataType(source.PropertyType);
if (umlDataType == null)
return null;
return ToPrimitiveType(umlDataType);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>MTConnect Transpiler Sink for C#</Title>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Authors>mtconnect, tbm0115</Authors>
<Company>MTConnect Institute; TAMS;</Company>
<Description>An implementation of `ITranspilerSink` from the `MtconnectTranspiler` library. This libary makes it possible to transpile the MTConnect Standard SysML model into C# code.</Description>
Expand Down

0 comments on commit 67d7087

Please sign in to comment.