return NULL;
}
- json_unpack(root, "{s:i}", "index", &h.index.id);
+ if (!json_unpack(root, "{s:I}", "index", &h.index.id)) {
+ h.index.id++;
+ }
rule = rule_alloc(int_loc, NULL);
"expr", &tmp))
return NULL;
json_unpack(root, "{s:I}", "handle", &h.handle.id);
- json_unpack(root, "{s:I}", "index", &h.index.id);
+ if (!json_unpack(root, "{s:I}", "index", &h.index.id)) {
+ h.index.id++;
+ }
if (op == CMD_REPLACE && !h.handle.id) {
json_error(ctx, "Handle is required when replacing a rule.");