diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-12-18 22:50:30 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-12-18 22:50:30 +0000 |
| commit | b6e54c2c9d89016df4e1efe98974d6d69c9cc22b (patch) | |
| tree | dfec535ab13bf48bbf9d423543c9a842129329b7 | |
| parent | 8b8c91182bef703e9ea6b89bd6c93eafa71bc97f (diff) | |
swaroop: at least partially fix crashes when trying to set the background image to something invalid.v2.13.87
| -rw-r--r-- | src/wx/player_config_dialog.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc index b16c76b36..ab7228438 100644 --- a/src/wx/player_config_dialog.cc +++ b/src/wx/player_config_dialog.cc @@ -313,7 +313,16 @@ private: #ifdef DCPOMATIC_VARIANT_SWAROOP void background_image_changed () { - Config::instance()->set_player_background_image(wx_to_std(_background_image->GetPath())); + boost::filesystem::path const f = wx_to_std(_background_image->GetPath()); + if (!boost::filesystem::is_regular_file(f) || !wxImage::CanRead(std_to_wx(f.string()))) { + error_dialog (0, _("Could not load image file.")); + if (Config::instance()->player_background_image()) { + checked_set (_background_image, *Config::instance()->player_background_image()); + } + return; + } + + Config::instance()->set_player_background_image(f); } #endif |
