Skip to content

Commit

Permalink
Prevent division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed Jun 5, 2015
1 parent 206321b commit 4c272a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parse.c
Expand Up @@ -2817,7 +2817,7 @@ int16_t modfield_from_keycode(xcb_keycode_t keycode)
uint16_t modfield = 0;
xcb_keycode_t *mod_keycodes = NULL;
xcb_get_modifier_mapping_reply_t *reply = NULL;
if ((reply = xcb_get_modifier_mapping_reply(dpy, xcb_get_modifier_mapping(dpy), NULL)) != NULL) {
if ((reply = xcb_get_modifier_mapping_reply(dpy, xcb_get_modifier_mapping(dpy), NULL)) != NULL && reply->keycodes_per_modifier > 0) {
if ((mod_keycodes = xcb_get_modifier_mapping_keycodes(reply)) != NULL) {
unsigned int num_mod = xcb_get_modifier_mapping_keycodes_length(reply) / reply->keycodes_per_modifier;
for (unsigned int i = 0; i < num_mod; i++) {
Expand Down

0 comments on commit 4c272a5

Please sign in to comment.