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

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

Issue 598993002: Add missing null-tests to async error functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
Index: sdk/lib/async/stream_controller.dart
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index fe3fbddc72973bff4d4a5d909155a5da1540c08f..e51e86528601b3cae4db9a4b231a9bb4b1996ab4 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -168,6 +168,8 @@ abstract class StreamController<T> implements StreamSink<T> {
/**
* Send or enqueue an error event.
*
+ * The [error] must not be `null`.
+ *
* Also allows an objection stack trace object, on top of what [EventSink]
* allows.
*/
@@ -414,10 +416,12 @@ abstract class _StreamController<T> implements StreamController<T>,
* Send or enqueue an error event.
*/
void addError(Object error, [StackTrace stackTrace]) {
+ if (error == null) throw new ArgumentError("Error must not be null");
if (!_mayAddEvent) throw _badEventState();
AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
if (replacement != null) {
error = replacement.error;
+ if (error == null) error = new NullThrownError();
stackTrace = replacement.stackTrace;
}
_addError(error, stackTrace);

Powered by Google App Engine
This is Rietveld 408576698