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

Unified Diff: runtime/lib/byte_array.dart

Issue 11098065: Fix bug in ByteArray.subByteArray implementation for omitted length. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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: runtime/lib/byte_array.dart
diff --git a/runtime/lib/byte_array.dart b/runtime/lib/byte_array.dart
index a6efae205473d075a9ed794c0464b41f25f6a40b..feadf0e90a7024149f784b45fd33613a80d91da2 100644
--- a/runtime/lib/byte_array.dart
+++ b/runtime/lib/byte_array.dart
@@ -1513,8 +1513,11 @@ class _ByteArrayView implements ByteArray {
}
ByteArray subByteArray([int start = 0, int length]) {
+ if (start is! int) throw new ArgumentError("start is not an int");
if (length === null) {
karlklose 2012/10/11 08:18:18 Use ?length here?
- length = this.lengthInBytes();
+ length = this.lengthInBytes() - start;
+ } else if (length is! int) {
+ throw new ArgumentError("length is not an int");
}
return new _ByteArrayView(_array, _offset + start, length);
}

Powered by Google App Engine
This is Rietveld 408576698