Skip to content

Commit

Permalink
fix a possible segfault in hotkey preferences dialog
Browse files Browse the repository at this point in the history
selected_command_ might be -1 causing symbols["hotkey_description"] =
hotkey::get_description((*commands)[selected_command_]); to fail.

and remove a "case hotkey::SCOPE_COUNT: ..." which for forgotten in a
previous commit
  • Loading branch information
gfgtdf committed Jun 23, 2014
1 parent daaf8bd commit 6b8a39d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/hotkey/hotkey_preferences_display.cpp
Expand Up @@ -391,14 +391,14 @@ void hotkey_preferences_dialog::set_hotkey_menu(bool keep_viewport) {
if (!keep_viewport) {
active_hotkeys->sort_by(0);
active_hotkeys->reset_selection();
selected_command_ = active_hotkeys->selection();
} else {
active_hotkeys->move_selection_keeping_viewport(selected_command_);
// !hide and thus redraw only the current tab_'s items
active_hotkeys->hide(false);
add_button_.hide(false);
clear_button_.hide(false);
}
selected_command_ = active_hotkeys->selection();
utils::string_map symbols;
symbols["hotkey_description"] =
hotkey::get_description((*commands)[selected_command_]);
Expand Down Expand Up @@ -446,9 +446,6 @@ void hotkey_preferences_dialog::set_selection(int index) {
case hotkey::SCOPE_EDITOR:
hotkey::set_scope_active(hotkey::SCOPE_EDITOR);
break;
case hotkey::SCOPE_COUNT:
assert(false); // should not be reached
break;
}
set_hotkey_menu(true);
}
Expand Down

0 comments on commit 6b8a39d

Please sign in to comment.