From a23fc212ef40acf1ec9ea364e4773d7eb19c5462 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 26 Jan 2009 22:10:59 +0000 Subject: fix NULL pointer segfault --- src/ui/widget.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/widget.cc b/src/ui/widget.cc index ef5d472..15fa10f 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -171,13 +171,18 @@ void Widget::set_background(bool background) void Widget::set_label(std::string const & label) { - set_label(label.c_str()); + widget_label.assign(label); + aux::to_label(widget_label); } void Widget::set_label(char const *label) { - widget_label.assign(label); - aux::to_label(widget_label); + if (label) { + widget_label.assign(label); + aux::to_label(widget_label); + } else { + widget_label.clear(); + } } void Widget::set_palette(const Palette *palette) -- cgit v1.2.3