Skip to content

Commit

Permalink
Fix #3599: crash with custom themes on desktop PCs
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrkive committed Oct 6, 2018
1 parent 5b03a80 commit 4a23c8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -4,6 +4,7 @@
### Lua API
* Fix wesnoth.set_dialog_value not triggering re-layout. (issue #3572)
### Miscellaneous and bug fixes
* Fix crash with custom themes on desktop PCs. (issue #3599)
* Add --campaign-skip-story command line switch for skipping directly to turn 1. (issue #3472)
* Fix documentation of --render-image command line switch. (issue #3568)
### User interface
Expand Down
13 changes: 8 additions & 5 deletions src/theme.cpp
Expand Up @@ -462,12 +462,15 @@ theme::status_item::status_item(const config& cfg)

SDL_Rect& theme::countdown::location(const SDL_Rect& screen) const
{
if(desktop::battery_info::does_device_have_battery()) {
return status_item::location(screen);
} else {
return display::get_singleton()->get_theme().
get_status_item("battery")->location(screen);
if(!desktop::battery_info::does_device_have_battery()) {
const object* battery = display::get_singleton()->get_theme().
get_status_item("battery");
if(battery != nullptr) {
return battery->location(screen);
}
}

return status_item::location(screen);
}

theme::panel::panel(const config& cfg)
Expand Down

0 comments on commit 4a23c8b

Please sign in to comment.