From 26e094d56e996e76e995fd921ade7dcd0972171f Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Wed, 9 Dec 2015 14:04:02 +0100 Subject: [PATCH] Prevent segfault when invalid theme in options file, fixes #2991 --- rtgui/main.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtgui/main.cc b/rtgui/main.cc index bbfca0c52..4ca8b94d7 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -278,6 +278,12 @@ int main(int argc, char **argv) if (options.theme.empty()) { options.theme = "21-Gray-Gray"; + } else { + std::string themeFile = argv0 + "/themes/" + options.theme + ".gtkrc"; + if (!std::ifstream(themeFile)) { + printf ("Current theme in options file is invalid: %s\nChanging to 21-Gray-Gray\n", options.theme.c_str()); + options.theme = "21-Gray-Gray"; + } } if (!options.useSystemTheme) {