summaryrefslogtreecommitdiff
path: root/apps/gui/gwps-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r--apps/gui/gwps-common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 6c58c1d666..b4a2cf9596 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1279,9 +1279,9 @@ static int find_conditional_end(struct wps_data *data, int index)
1279 } 1279 }
1280 1280
1281 int ret = index; 1281 int ret = index;
1282 do 1282 while (data->tokens[ret].value.i != 0
1283 && data->tokens[data->tokens[ret].value.i].type != WPS_TOKEN_CONDITIONAL_END)
1283 ret = data->tokens[ret].value.i; 1284 ret = data->tokens[ret].value.i;
1284 while (data->tokens[ret].type != WPS_TOKEN_CONDITIONAL_END);
1285 1285
1286 /* ret now is the index to the end token for the conditional. */ 1286 /* ret now is the index to the end token for the conditional. */
1287 return ret; 1287 return ret;
@@ -1307,6 +1307,10 @@ static int evaluate_conditional(struct gui_wps *gwps, int cond_index)
1307 && cond_start < data->num_tokens) 1307 && cond_start < data->num_tokens)
1308 cond_start++; 1308 cond_start++;
1309 1309
1310 /* if the number of options is 0, the conditional is invalid */
1311 if (num_options == 0)
1312 return cond_start;
1313
1310 /* treat ?xx<true> constructs as if they had 2 options. */ 1314 /* treat ?xx<true> constructs as if they had 2 options. */
1311 if (num_options < 2) 1315 if (num_options < 2)
1312 num_options = 2; 1316 num_options = 2;