| Index: pkg/barback/lib/src/utils.dart
|
| diff --git a/pkg/barback/lib/src/utils.dart b/pkg/barback/lib/src/utils.dart
|
| index 51d98eef0b0b0aa89611bfc4ebaa2edcad23fd81..d180137a69544a64035c0da567797df28f426949 100644
|
| --- a/pkg/barback/lib/src/utils.dart
|
| +++ b/pkg/barback/lib/src/utils.dart
|
| @@ -194,9 +194,10 @@ Stream futureStream(Future<Stream> future, {bool broadcast: false}) {
|
| var controller;
|
|
|
| future = future.catchError((e, stackTrace) {
|
| - if (controller == null) return;
|
| - controller.addError(e, stackTrace);
|
| - controller.close();
|
| + // Since [controller] is synchronous, it's likely that emitting an error
|
| + // will cause it to be cancelled before we call close.
|
| + if (controller != null) controller.addError(e, stackTrace);
|
| + if (controller != null) controller.close();
|
| controller = null;
|
| });
|
|
|
|
|