The function was changed to return an expression or NULL but error
checking wasn't adjusted while doing so.

Fixes: dba4a9b4b5fe2 ("src: allow variable in chain policy")
Signed-off-by: Phil Sutter <p...@nwl.cc>
---
 src/parser_json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/parser_json.c b/src/parser_json.c
index 55dbc177cc98d..fe0c5df98f5d4 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -2630,7 +2630,7 @@ static struct cmd *json_parse_cmd_add_chain(struct 
json_ctx *ctx, json_t *root,
                chain->dev = xstrdup(chain->dev);
        if (!json_unpack(root, "{s:s}", "policy", &policy)) {
                chain->policy = parse_policy(policy);
-               if (chain->policy < 0) {
+               if (!chain->policy) {
                        json_error(ctx, "Unknown policy '%s'.", policy);
                        chain_free(chain);
                        return NULL;
-- 
2.23.0

Reply via email to