Procházet zdrojové kódy

ElementAt: don't create exception after finding the item (#671)

David Karnok před 7 roky
rodič
revize
421e2a26ad

+ 4 - 1
Rx.NET/Source/src/System.Reactive/Linq/Observable/ElementAt.cs

@@ -42,7 +42,10 @@ namespace System.Reactive.Linq.ObservableImpl
 
             public override void OnCompleted()
             {
-                ForwardOnError(new ArgumentOutOfRangeException("index"));
+                if (_i >= 0)
+                {
+                    ForwardOnError(new ArgumentOutOfRangeException("index"));
+                }
             }
         }
     }