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/vm/native_entry.cc

Issue 2944483003: Fail more helpfully when invoking a null native function. (Closed)
Patch Set: . Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/native_entry.cc
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index f89c9a050fa644f458d693554e1f66214d6f85e7..c7e194b7726c6952af1484707ec8124717fdb5bf 100644
--- a/runtime/vm/native_entry.cc
+++ b/runtime/vm/native_entry.cc
@@ -39,7 +39,7 @@ NativeFunction NativeEntry::ResolveNative(const Library& library,
int number_of_arguments,
bool* auto_setup_scope) {
// Now resolve the native function to the corresponding native entrypoint.
- if (library.native_entry_resolver() == 0) {
+ if (library.native_entry_resolver() == NULL) {
// Native methods are not allowed in the library to which this
// class belongs in.
return NULL;
@@ -62,7 +62,7 @@ const uint8_t* NativeEntry::ResolveSymbolInLibrary(const Library& library,
uword pc) {
Dart_NativeEntrySymbol symbol_resolver =
library.native_entry_symbol_resolver();
- if (symbol_resolver == 0) {
+ if (symbol_resolver == NULL) {
// Cannot reverse lookup native entries.
return NULL;
}
@@ -232,8 +232,13 @@ static NativeFunction ResolveNativeFunction(Zone* zone,
ASSERT(!native_name.IsNull());
const int num_params = NativeArguments::ParameterCountForResolution(func);
- return NativeEntry::ResolveNative(library, native_name, num_params,
- is_auto_scope);
+ NativeFunction native_function = NativeEntry::ResolveNative(
+ library, native_name, num_params, is_auto_scope);
+ if (native_function == NULL) {
+ FATAL2("Failed to resolve native function '%s' in '%s'\n",
+ native_name.ToCString(), func.ToQualifiedCString());
+ }
+ return native_function;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698