| Index: runtime/vm/dart_api_impl.cc
|
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
|
| index a826afe32ec274256420d2f23da88d6dc6738955..5e9b9cea7e2fcbfcb3fa92411488c68a332fd9ce 100644
|
| --- a/runtime/vm/dart_api_impl.cc
|
| +++ b/runtime/vm/dart_api_impl.cc
|
| @@ -5131,6 +5131,10 @@ DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer,
|
| NoHeapGrowthControlScope no_growth_control;
|
|
|
| const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
|
| + if (snapshot == NULL) {
|
| + return Api::NewError("%s expects parameter 'buffer' to be a script type"
|
| + " snapshot with a valid length.", CURRENT_FUNC);
|
| + }
|
| if (!snapshot->IsScriptSnapshot()) {
|
| return Api::NewError("%s expects parameter 'buffer' to be a script type"
|
| " snapshot.", CURRENT_FUNC);
|
|
|