Fix null response handling.

R=kevmoo@google.com

Review URL: https://codereview.chromium.org//1030013003
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e66a474..9f6208b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.6.1+1
+
+* Don't throw a bogus exception for `null` responses.
+
 ## 0.6.1
 
 * `shelf_io` now takes a `"shelf.io.buffer_output"` `Response.context` parameter
diff --git a/lib/shelf_io.dart b/lib/shelf_io.dart
index 301050f..d5eb017 100644
--- a/lib/shelf_io.dart
+++ b/lib/shelf_io.dart
@@ -84,7 +84,8 @@
     return _logError('Error thrown by handler.\n$error', stackTrace);
   }).then((response) {
     if (response == null) {
-      response = _logError('null response from handler.');
+      return _writeResponse(
+          _logError('null response from handler.'), request.response);
     } else if (shelfRequest.canHijack) {
       return _writeResponse(response, request.response);
     }
diff --git a/pubspec.yaml b/pubspec.yaml
index 0a94fe4..db9ae1f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: shelf
-version: 0.6.1
+version: 0.6.1+1
 author: Dart Team <misc@dartlang.org>
 description: Web Server Middleware for Dart
 homepage: https://github.com/dart-lang/shelf