From 8445256dab6065706005508e87cfbd02a06191ec Mon Sep 17 00:00:00 2001 From: John Darrington Date: Thu, 11 Aug 2016 21:52:52 +0200 Subject: [PATCH] Fix possible null pointer dereference. Found by cppcheck --- src/language/lexer/variable-parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/language/lexer/variable-parser.c b/src/language/lexer/variable-parser.c index a45d384293..390b98dae3 100644 --- a/src/language/lexer/variable-parser.c +++ b/src/language/lexer/variable-parser.c @@ -201,9 +201,9 @@ add_variable (struct variable ***v, size_t *nv, size_t *mv, "All variables in this variable list must have the " "same width. %s will be omitted from the list."), var_get_name ((*v)[0]), add_name, add_name); - else if ((pv_opts & PV_NO_DUPLICATE) && included[idx]) + else if ((pv_opts & PV_NO_DUPLICATE) && included && included[idx]) msg (SE, _("Variable %s appears twice in variable list."), add_name); - else if ((pv_opts & PV_DUPLICATE) || !included[idx]) + else if ((pv_opts & PV_DUPLICATE) || !included || !included[idx]) { if (*nv >= *mv) { -- 2.30.2