summaryrefslogtreecommitdiff
path: root/lib/northbound_oper.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/northbound_oper.c')
-rw-r--r--lib/northbound_oper.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/northbound_oper.c b/lib/northbound_oper.c
index 626c37082e..d9ad9b1701 100644
--- a/lib/northbound_oper.c
+++ b/lib/northbound_oper.c
@@ -157,7 +157,8 @@ nb_op_create_yield_state(const char *xpath, struct yang_translator *translator,
/* remove trailing '/'s */
while (darr_len(ys->xpath) > 1 && ys->xpath[darr_len(ys->xpath) - 2] == '/') {
darr_setlen(ys->xpath, darr_len(ys->xpath) - 1);
- *darr_last(ys->xpath) = 0;
+ if (darr_last(ys->xpath))
+ *darr_last(ys->xpath) = 0;
}
ys->xpath_orig = darr_strdup(xpath);
ys->translator = translator;