File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/Microsoft.OpenApi.OData.Reader/Edm Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -135,14 +135,15 @@ private void AppendPath(ODataPath path)
135135 case ODataPathKind . EntitySet :
136136 case ODataPathKind . Singleton :
137137 case ODataPathKind . MediaEntity :
138- ODataNavigationSourceSegment navigationSourceSegment = ( ODataNavigationSourceSegment ) path . FirstSegment ;
139- if ( ! _allNavigationSourcePaths . TryGetValue ( navigationSourceSegment . EntityType , out IList < ODataPath > nsList ) )
138+ if ( path . FirstSegment is ODataNavigationSourceSegment navigationSourceSegment )
140139 {
141- nsList = new List < ODataPath > ( ) ;
142- _allNavigationSourcePaths [ navigationSourceSegment . EntityType ] = nsList ;
140+ if ( ! _allNavigationSourcePaths . TryGetValue ( navigationSourceSegment . EntityType , out IList < ODataPath > nsList ) )
141+ {
142+ nsList = new List < ODataPath > ( ) ;
143+ _allNavigationSourcePaths [ navigationSourceSegment . EntityType ] = nsList ;
144+ }
145+ nsList . Add ( path ) ;
143146 }
144-
145- nsList . Add ( path ) ;
146147 break ;
147148
148149 case ODataPathKind . NavigationProperty :
@@ -440,7 +441,8 @@ private bool ShouldExpandNavigationProperty(IEdmNavigationProperty navigationPro
440441 IEdmEntityType navEntityType = navigationProperty . ToEntityType ( ) ;
441442 foreach ( ODataSegment segment in currentPath )
442443 {
443- if ( navEntityType . IsAssignableFrom ( segment . EntityType ) )
444+ if ( segment . EntityType != null &&
445+ navEntityType . IsAssignableFrom ( segment . EntityType ) )
444446 {
445447 return false ;
446448 }
You can’t perform that action at this time.
0 commit comments