Index: sdk/lib/convert/latin1.dart |
diff --git a/sdk/lib/convert/latin1.dart b/sdk/lib/convert/latin1.dart |
index dd9c65f0e3859734fb06783112078322339c7f83..7f7fef883ca18a23d209a27193fdfea92e7ff277 100644 |
--- a/sdk/lib/convert/latin1.dart |
+++ b/sdk/lib/convert/latin1.dart |
@@ -132,12 +132,7 @@ class _Latin1DecoderSink extends ByteConversionSinkBase { |
} |
void addSlice(List<int> source, int start, int end, bool isLast) { |
- if (start < 0 || start > source.length) { |
- throw new RangeError.range(start, 0, source.length); |
- } |
- if (end < start || end > source.length) { |
- throw new RangeError.range(end, start, source.length); |
- } |
+ RangeError.checkValidRange(start, end, source.length); |
for (int i = start; i < end; i++) { |
int char = source[i]; |
if (char > _LATIN1_MASK || char < 0) { |
@@ -157,12 +152,7 @@ class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink { |
_Latin1AllowInvalidDecoderSink(StringConversionSink sink): super(sink); |
void addSlice(List<int> source, int start, int end, bool isLast) { |
- if (start < 0 || start > source.length) { |
- throw new RangeError.range(start, 0, source.length); |
- } |
- if (end < start || end > source.length) { |
- throw new RangeError.range(end, start, source.length); |
- } |
+ RangeError.checkValidRange(start, end, source.length); |
for (int i = start; i < end; i++) { |
int char = source[i]; |
if (char > _LATIN1_MASK || char < 0) { |