keymap: fix NULL dereference when dumping the default fallback type
authorRan Benita <ran234@gmail.com>
Tue, 12 Dec 2017 12:30:21 +0000 (14:30 +0200)
committerRan Benita <ran234@gmail.com>
Tue, 12 Dec 2017 12:33:24 +0000 (14:33 +0200)
commit26453b84732da870f5695ee347970b337cfea9c1
treefd9e6b43b895cc146d9ff7e21140dc5171b01a1c
parent9f85d6b78cc05f798a2d335774ee1cedc5b2b784
keymap: fix NULL dereference when dumping the default fallback type

The default fallback type uses
    type->level_names = NULL
but the keymap-dump code was not checking this case.

Instead of adding more workarounds and possible bugs (e.g. previous
commit), let's just keep the number of level names separately. This has
the additional advantage retains extraneous level name if someone adds
them for some reason.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/keymap.h
src/xkbcomp/keymap-dump.c
src/xkbcomp/types.c