提交 f17f006f 编写于 作者: J Jason Simmons

Raise an exception when converting a DartWrappable with empty native fields

Fixes https://github.com/flutter/flutter/issues/2391
上级 88dc1381
......@@ -9,6 +9,7 @@
namespace blink {
namespace DartError {
const char kInvalidArgument[] = "Invalid argument.";
const char kInvalidDartWrappable[] = "Invalid Dart wrappable object.";
} // namespace DartError
bool LogIfError(Dart_Handle handle) {
......
......@@ -11,6 +11,7 @@ namespace blink {
namespace DartError {
extern const char kInvalidArgument[];
extern const char kInvalidDartWrappable[];
} // namespace DartError
bool LogIfError(Dart_Handle handle);
......
......@@ -101,6 +101,10 @@ DartWrappable* DartConverterWrappable::FromArguments(Dart_NativeArguments args,
exception = Dart_NewStringFromCString(DartError::kInvalidArgument);
return nullptr;
}
if (!native_fields[DartWrappable::kPeerIndex]) {
exception = Dart_NewStringFromCString(DartError::kInvalidDartWrappable);
return nullptr;
}
return reinterpret_cast<DartWrappable*>(
native_fields[DartWrappable::kPeerIndex]);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册