문제

ReSharper notifies me about a possible System.NullReferenceException for the following code:

 IEnumerator<IEdgeData> edgeEnumerator = edgeData.GetEnumerator();
 while (edgeEnumerator.MoveNext())
 {
    ConvId fromConvId = edgeEnumerator.Current.From;
    ...
 }

Specifically, it underlines:

edgeEnumerator.Current

I cannot figure out under which circumstances the exception could occur. My understanding is that the while-loops inner statements will only be executed if MoveNext() can set the enumerator on the next element.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top