Skip to content
Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
fooishbar committed Aug 3, 2018
1 parent 87046f5 commit a8ea7a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/xkbcomp/parser.y
Expand Up @@ -239,9 +239,9 @@ resolve_keysym(const char *name, xkb_keysym_t *sym_rtrn)
*/

XkbFile : XkbCompositeMap
{ $$ = param->rtrn = $1; param->more_maps = true; }
{ $$ = param->rtrn = $1; param->more_maps = !!param->rtrn; }
| XkbMapConfig
{ $$ = param->rtrn = $1; param->more_maps = true; YYACCEPT; }
{ $$ = param->rtrn = $1; param->more_maps = !!param->rtrn; YYACCEPT; }
| END_OF_FILE
{ $$ = param->rtrn = NULL; param->more_maps = false; }
;
Expand Down Expand Up @@ -772,6 +772,7 @@ parse(struct xkb_context *ctx, struct scanner *scanner, const char *map)
.scanner = scanner,
.ctx = ctx,
.rtrn = NULL,
.more_maps = false,
};

/*
Expand Down

1 comment on commit a8ea7a1

@msmeissn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.