@@ -137,7 +137,7 @@ public string GetInheritedValue(string attributeKey, FilePathAttributeTopicViewM
137137 inheritedValue = GetPath ( attributeKey , attribute ) ;
138138 }
139139 else if ( attribute . InheritValue == true ) {
140- inheritedValue = CurrentTopic . Attributes . GetValue ( attributeKey , true ) ;
140+ inheritedValue = CurrentTopic ? . Attributes . GetValue ( attributeKey , true ) ?? "" ;
141141 }
142142
143143 return inheritedValue ;
@@ -164,7 +164,7 @@ public string GetPath(string attributeKey, FilePathAttributeTopicViewModel optio
164164 var filePath = "" ;
165165 var relativePath = ( string ? ) null ;
166166 var startTopic = CurrentTopic ;
167- var endTopic = ( options . IncludeCurrentTopic is null ) ? CurrentTopic : CurrentTopic . Parent ?? CurrentTopic ;
167+ var endTopic = ( options . IncludeCurrentTopic is null ) ? CurrentTopic : CurrentTopic ? . Parent ?? CurrentTopic ;
168168 var truncatePathAtTopic = options . BaseTopicPath ? . Split ( ',' ) . ToArray ( ) ?? Array . Empty < string > ( ) ;
169169
170170 /*------------------------------------------------------------------------------------------------------------------------
@@ -186,13 +186,13 @@ public string GetPath(string attributeKey, FilePathAttributeTopicViewModel optio
186186 | Add topic keys (directory names) between the start topic and the end topic based on the topic's WebPath property
187187 \-----------------------------------------------------------------------------------------------------------------------*/
188188 if ( startTopic != null ) {
189- if ( startTopic . GetWebPath ( ) . Length > endTopic . GetWebPath ( ) . Length ) {
189+ if ( startTopic . GetWebPath ( ) . Length > endTopic ? . GetWebPath ( ) . Length ) {
190190 throw new InvalidOperationException (
191191 $ "The path of { startTopic . GetWebPath ( ) } should be shorter than the length of { endTopic . GetWebPath ( ) } ."
192192 ) ;
193193 }
194194 var startTopicWebPath = startTopic . GetWebPath ( ) . Replace ( "/Root/" , "/" ) ;
195- relativePath = endTopic . GetWebPath ( ) . Substring ( Math . Max ( startTopicWebPath . Length - 1 , 0 ) ) ;
195+ relativePath = endTopic ? . GetWebPath ( ) . Substring ( Math . Max ( startTopicWebPath . Length - 1 , 0 ) ) ;
196196 }
197197
198198 /*------------------------------------------------------------------------------------------------------------------------
0 commit comments