summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/uci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/uci.c b/lib/uci.c
index e00f77e..be98214 100644
--- a/lib/uci.c
+++ b/lib/uci.c
@@ -49,7 +49,7 @@ uc_uci_error(uc_vm *vm, size_t nargs)
if (last_error == 0)
return NULL;
- if (errstr[last_error]) {
+ if (last_error >= 0 && last_error < ARRAY_SIZE(errstr)) {
errmsg = json_object_new_string(errstr[last_error]);
}
else {
@@ -993,6 +993,7 @@ static const uc_cfunction_list cursor_fns[] = {
{ "changes", uc_uci_changes },
{ "foreach", uc_uci_foreach },
{ "configs", uc_uci_configs },
+ { "error", uc_uci_error },
};
static const uc_cfunction_list global_fns[] = {