Skip to content

Commit

Permalink
- fixes a null reference exception on implicit nav props detection
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Sep 29, 2020
1 parent 5e806d9 commit 3ff2dd8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/GraphODataTemplateWriter/Extensions/OdcmModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,18 @@ public static OdcmProperty GetServiceCollectionNavigationPropertyForPropertyType
@namespace
.Classes
.Where(odcmClass => odcmClass.Kind == OdcmClassKind.Service)
.First()
.Properties
.Where(property => property.GetType() == typeof(OdcmSingleton)) //Get the list of singletons defined by the service
.Where(singleton => singleton
.FirstOrDefault()
?.Properties
?.Where(property => property.GetType() == typeof(OdcmSingleton)) //Get the list of singletons defined by the service
?.Where(singleton => singleton
.Type
.AsOdcmClass()
.Properties
//Find navigation properties on the singleton that are self-contained (implicit EntitySets) that match the type
//we are searching for
.Where(prop => prop.ContainsTarget == true && prop.Type.Name == odcmProperty.Type.Name)
.FirstOrDefault() != null
)
) ?? new OdcmProperty[] { }
).FirstOrDefault();

if (implicitProperty != null)
Expand Down

0 comments on commit 3ff2dd8

Please sign in to comment.