[gjs/wip/require: 5/7] 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: 5/7] native: Return NULL if the module isn't registered
- Date: Fri, 3 Jan 2014 16:47:32 +0000 (UTC)
commit aa6664426ef2d493c3ec30fb987a5abde2b605b3
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 ad1c648..c6db521 100644
--- a/gjs/native.cpp
+++ b/gjs/native.cpp
@@ -98,12 +98,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]