From 7a61fe8504d846317088f85458c94b0e00a59cb9 Mon Sep 17 00:00:00 2001 From: Cesare Tirabassi Date: Sun, 23 May 2010 11:25:19 +0200 Subject: [PATCH] Fix battery_bar not parsing arguments correctly (sf: #2998034, lp: #569195) --- src/core.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core.cc b/src/core.cc index 2de64478..04e8b9db 100644 --- a/src/core.cc +++ b/src/core.cc @@ -434,12 +434,13 @@ struct text_object *construct_text_object(char *s, const char *arg, long obj->callbacks.free = &gen_free_opaque; END OBJ(battery_bar, 0) char bat[64]; - if (arg) { + + arg = scan_bar(obj, arg, 100); + if (arg && strlen(arg)>0) { sscanf(arg, "%63s", bat); } else { strcpy(bat, "BAT0"); } - scan_bar(obj, bat, 100); obj->data.s = strndup(bat, text_buffer_size); obj->callbacks.barval = &get_battery_perct_bar; obj->callbacks.free = &gen_free_opaque;