Skip to content

Commit

Permalink
Validate a pointer before deferring it.
Browse files Browse the repository at this point in the history
The problem was introduced in 818ffad, David Mikos please review this
patch.

Issue found by cppcheck.
  • Loading branch information
mordante committed Feb 9, 2014
1 parent ff4c0eb commit 837bf59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/game_preferences_display.cpp
Expand Up @@ -1102,10 +1102,10 @@ void preferences_dialog::process_event()
}

const config* const adv = get_advanced_pref();
const config& pref = *adv;
const bool double_click_toggle_boolean = advanced_.double_clicked() &&
pref["type"] == "boolean";
const bool double_click_toggle_boolean = adv
? advanced_.double_clicked() && (*adv)["type"] == "boolean"
: false;

if(advanced_button_.pressed() || double_click_toggle_boolean) {
bool advanced_button_check = advanced_button_.checked();
if (double_click_toggle_boolean) {
Expand Down

0 comments on commit 837bf59

Please sign in to comment.