Skip to content

Commit a8ea7a1

Browse files
committed
parser: Don't set more maps when we don't have any
If the scanner indicates that we might have something which looks like a map, but the parser in fact fails to create that map, we will try to access the map regardless. Stop doing that. testcase: 'xkb_keymap {' -> '#kb_keymap' Signed-off-by: Daniel Stone <daniels@collabora.com>
1 parent 87046f5 commit a8ea7a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/xkbcomp/parser.y

+3-2
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ resolve_keysym(const char *name, xkb_keysym_t *sym_rtrn)
239239
*/
240240

241241
XkbFile : XkbCompositeMap
242-
{ $$ = param->rtrn = $1; param->more_maps = true; }
242+
{ $$ = param->rtrn = $1; param->more_maps = !!param->rtrn; }
243243
| XkbMapConfig
244-
{ $$ = param->rtrn = $1; param->more_maps = true; YYACCEPT; }
244+
{ $$ = param->rtrn = $1; param->more_maps = !!param->rtrn; YYACCEPT; }
245245
| END_OF_FILE
246246
{ $$ = param->rtrn = NULL; param->more_maps = false; }
247247
;
@@ -772,6 +772,7 @@ parse(struct xkb_context *ctx, struct scanner *scanner, const char *map)
772772
.scanner = scanner,
773773
.ctx = ctx,
774774
.rtrn = NULL,
775+
.more_maps = false,
775776
};
776777

777778
/*

0 commit comments

Comments
 (0)