Index: runtime/bin/socket_patch.dart |
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart |
index 76289c505c7cf4e47e6f93479a3ed85dffa20d4f..27329f139abece776673f92b4604f1e6b353c515 100644 |
--- a/runtime/bin/socket_patch.dart |
+++ b/runtime/bin/socket_patch.dart |
@@ -449,7 +449,9 @@ class _NativeSocket extends NativeFieldWrapperClass1 { |
throw new ArgumentError("Illegal length $len"); |
} |
if (isClosing || isClosed) return null; |
- var result = nativeRead(min(available, len == null ? available : len)); |
+ len = min(available, len == null ? available : len); |
+ if (len == 0) return null; |
+ var result = nativeRead(len); |
if (result is OSError) { |
reportError(result, "Read failed"); |
return null; |