Skip to content

Commit 252e775

Browse files
authored
Merge pull request #854 from microsoftgraph/fixgeneration
Fix null reference exception when method return type is an odata primitive.
2 parents 1eabbbf + 82f7106 commit 252e775

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/GraphODataTemplateWriter/Extensions/OdcmModelExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,10 @@ public static List<OdcmProperty> GetComposableFunctionReturnTypeNavigations(this
730730
throw new InvalidOperationException("This extension method is intended " +
731731
"to only be called on a composable function.");
732732

733-
return (odcmMethod.ReturnType as OdcmClass).Properties
733+
return (odcmMethod.ReturnType as OdcmClass)?.Properties
734734
.Where(p => p.IsLink)
735735
.OrderBy(p => p.Name)
736-
.ToList();
736+
.ToList() ?? new List<OdcmProperty>(); // default to empty list
737737
}
738738

739739
/// <summary>

0 commit comments

Comments
 (0)