From cf1940f8cba5549e6a2de39029fea48fc6c3ebcc Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 9 Jan 2017 23:01:09 +0100 Subject: [PATCH] Reset theme if parsing fails, so we don't display using 1/2 parsed theme --- source/rofi.c | 10 ++++++---- source/widgets/widget.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/rofi.c b/source/rofi.c index 70319540..9f6f14db 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -979,8 +979,10 @@ int main ( int argc, char *argv[] ) if ( config.theme ) { TICK_N ( "Parse theme" ); - if ( !rofi_theme_parse_file ( config.theme ) ) { + if ( rofi_theme_parse_file ( config.theme ) ) { // TODO: instantiate fallback theme.? + rofi_theme_free ( rofi_theme ); + rofi_theme = NULL; } TICK_N ( "Parsed theme" ); } @@ -991,9 +993,9 @@ int main ( int argc, char *argv[] ) const char ** theme_str = find_arg_strv ( "-theme-str" ); if ( theme_str ) { for ( int index = 0; theme_str && theme_str[index]; index++ ) { - if ( !rofi_theme_parse_string ( theme_str[index] ) ) { - fprintf ( stderr, "Failed to parse: %s\n", theme_str[index] ); - exit ( EXIT_FAILURE ); + if ( rofi_theme_parse_string ( theme_str[index] ) ) { + rofi_theme_free ( rofi_theme ); + rofi_theme = NULL; } } g_free ( theme_str ); diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 14235a28..c3460b06 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -4,7 +4,7 @@ #include "theme.h" /** Default padding. */ -#define WIDGET_DEFAULT_PADDING 2 +#define WIDGET_DEFAULT_PADDING 0 void widget_init ( widget *widget, const char *name ) {