diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2018-10-28 20:14:49 -0400 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2018-10-30 09:31:44 -0400 |
commit | ed523c6d8acef93413bb51ea0c26077e4cf79692 (patch) | |
tree | 0defd359e5a828497c037e236a49f4b919dfdbb1 /gi/repo.cpp | |
parent | 221ffc189ad49b05e36aa38ca6cccee59c7dfd3e (diff) | |
download | gjs-ed523c6d8acef93413bb51ea0c26077e4cf79692.tar.gz |
jsapi-util: Fix error handling in gjs_get_string_id()
This makes gjs_get_string_id() conform to the JSAPI return convention, so
that it is clear when an exception is pending.
Diffstat (limited to 'gi/repo.cpp')
-rw-r--r-- | gi/repo.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gi/repo.cpp b/gi/repo.cpp index 0f34c84a..adefb8bf 100644 --- a/gi/repo.cpp +++ b/gi/repo.cpp @@ -93,6 +93,10 @@ static bool resolve_namespace_object(JSContext* context, JS::UniqueChars ns_name; if (!gjs_get_string_id(context, ns_id, &ns_name)) return false; + if (!ns_name) { + gjs_throw(context, "Requiring invalid namespace on imports.gi"); + return false; + } GList* versions = g_irepository_enumerate_versions(nullptr, ns_name.get()); unsigned nversions = g_list_length(versions); |