jfkeys: fix key levels not working at all

This commit is contained in:
Lephenixnoir 2022-12-01 11:00:41 +01:00
parent beeb0c0724
commit 40ffe54250
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -55,7 +55,11 @@ void jfkeys_set(jfkeys *f, char const *labels)
static char const *get_level(char const *labels, int level)
{
/* Navigate to level */
while(level > 0) labels = strchrnul(labels, '|');
while(level > 0) {
labels = strchrnul(labels, '|');
labels += (*labels == '|');
level--;
}
return (*labels == 0) ? NULL : labels;
}