| Index: runtime/lib/typed_data.cc
|
| ===================================================================
|
| --- runtime/lib/typed_data.cc (revision 22079)
|
| +++ runtime/lib/typed_data.cc (working copy)
|
| @@ -42,7 +42,6 @@
|
|
|
| // Checks to see if a length will not result in an OOM error.
|
| static void LengthCheck(intptr_t len, intptr_t max) {
|
| - ASSERT(len >= 0);
|
| if (len > max) {
|
| const String& error = String::Handle(String::NewFormatted(
|
| "insufficient memory to allocate a TypedData object of length (%"Pd")",
|
| @@ -50,6 +49,12 @@
|
| const Array& args = Array::Handle(Array::New(1));
|
| args.SetAt(0, error);
|
| Exceptions::ThrowByType(Exceptions::kOutOfMemory, args);
|
| + } else if (len < 0) {
|
| + const String& error = String::Handle(String::NewFormatted(
|
| + "%"Pd" must be greater than 0", len));
|
| + const Array& args = Array::Handle(Array::New(1));
|
| + args.SetAt(0, error);
|
| + Exceptions::ThrowByType(Exceptions::kArgument, args);
|
| }
|
| }
|
|
|
|
|