Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: sdk/lib/async/stream_pipe.dart

Issue 2444363004: Handle the case of Stream.take(0) better. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/async/stream_take_test.dart » ('j') | tests/lib/async/stream_take_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream_pipe.dart
diff --git a/sdk/lib/async/stream_pipe.dart b/sdk/lib/async/stream_pipe.dart
index d26b0c5f64c86fc97c1df3c06a879e81c9c480fd..caf94a1f02b570392891ac028440ac61d9a5859e 100644
--- a/sdk/lib/async/stream_pipe.dart
+++ b/sdk/lib/async/stream_pipe.dart
@@ -326,6 +326,9 @@ class _TakeStream<T> extends _ForwardingStream<T, T> {
Function onError,
void onDone(),
bool cancelOnError) {
+ if (_count == 0) {
+ return new _DoneSubscription<T>(onDone);
+ }
return new _StateStreamSubscription<T>(
this, onData, onError, onDone, cancelOnError, _count);
}
« no previous file with comments | « no previous file | tests/lib/async/stream_take_test.dart » ('j') | tests/lib/async/stream_take_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698