Skip to content

Commit

Permalink
Fix dereference after null check in ratesdlg.cpp
Browse files Browse the repository at this point in the history
Closes #2072.
Coverity CID 1528901.
  • Loading branch information
lmoureaux committed Dec 25, 2023
1 parent 90c02c5 commit b8bfe2b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/ratesdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ national_budget_dialog::national_budget_dialog(QWidget *parent)
*/
void national_budget_dialog::refresh()
{
const int max = client.conn.playing
? get_player_bonus(client.conn.playing, EFT_MAX_RATES)
: 100;
if (!client.conn.playing) {
// The budget dialog doesn't make sense without a player
return;
}

const int max = get_player_bonus(client.conn.playing, EFT_MAX_RATES);

// Trans: Government - max rate (of taxes) x%
m_info->setText(QString(_("%1 - max rate: %2%"))
Expand Down

0 comments on commit b8bfe2b

Please sign in to comment.