Index: sdk/lib/async/stream_controller.dart |
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart |
index 87b64e893d1e52dc89f7b55f5b3ca19175a0bba1..d6cc66784cd2ffd98eee403ea086900a9a4a750a 100644 |
--- a/sdk/lib/async/stream_controller.dart |
+++ b/sdk/lib/async/stream_controller.dart |
@@ -709,10 +709,9 @@ abstract class _StreamController<T> implements StreamController<T>, |
if (onCancel != null) { |
if (result == null) { |
- // Only introduce a future if one is needed. |
- // If _onCancel returns null, no future is needed. |
+ // Introduce a future if none was returned. |
try { |
- result = onCancel(); |
+ result = onCancel() ?? new Future.value(null); |
Lasse Reichstein Nielsen
2016/08/01 15:23:26
Use `Future._nullFuture`.
floitsch
2016/08/01 21:00:37
Moved the 'Future._nullFuture' to the `cancel` fun
|
} catch (e, s) { |
// Return the error in the returned future. |
// Complete it asynchronously, so there is time for a listener |