[gjs/wip/require: 9/11] native: Return NULL if the module isn't registered
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/require: 9/11] native: Return NULL if the module isn't registered
- Date: Wed, 15 Jan 2014 16:58:48 +0000 (UTC)
commit bcfdf84b5404d1709622291ec0b4e890820733c7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jan 2 17:52:57 2014 -0500
native: Return NULL if the module isn't registered
This can't ever happen in practice, since existing callers check
gjs_is_registered_native_module, but with our new loader, it's a
bit more convenient to simply check against NULL rather than have
to do a precheck or catch an exception first.
gjs/native.cpp | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gjs/native.cpp b/gjs/native.cpp
index 65a528b..a313592 100644
--- a/gjs/native.cpp
+++ b/gjs/native.cpp
@@ -97,12 +97,10 @@ gjs_import_native_module(JSContext *context,
else
func = NULL;
- if (!func) {
- gjs_throw(context,
- "No native module '%s' has registered itself",
- name);
- return JS_FALSE;
+ if (func) {
+ return func (context, module_out);
+ } else {
+ *module_out = NULL;
+ return JS_TRUE;
}
-
- return func (context, module_out);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]