File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -180,17 +180,25 @@ public bool CheckRead()
180180 /// <returns><c>true</c> if the read succeeded, otherwise <c>false</c>.</returns>
181181 public bool TryRead ( [ MaybeNullWhen ( returnValue : false ) ] out T value )
182182 {
183- // Try to prefetch a value.
184- if ( ! CheckRead ( ) )
183+ try
184+ {
185+ // Try to prefetch a value.
186+ if ( ! CheckRead ( ) )
187+ {
188+ value = default ( T ) ;
189+ return false ;
190+ }
191+
192+ // There was at least one value prefetched.
193+ // Return it to the caller.
194+ value = m_queue . Pop ( ) ;
195+ return true ;
196+ }
197+ catch
185198 {
186199 value = default ( T ) ;
187200 return false ;
188201 }
189-
190- // There was at least one value prefetched.
191- // Return it to the caller.
192- value = m_queue . Pop ( ) ;
193- return true ;
194202 }
195203
196204 /// <summary>
You can’t perform that action at this time.
0 commit comments