From 5cef8b6505b69c4c69446fec29666c42f57cf5e5 Mon Sep 17 00:00:00 2001 From: fluxgen <fluxgen> Date: Thu, 28 Nov 2002 19:22:40 +0000 Subject: return false if we cant parse nor allocate color string --- src/FbTk/Color.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/FbTk/Color.cc b/src/FbTk/Color.cc index 2e69f1c..6e13c65 100644 --- a/src/FbTk/Color.cc +++ b/src/FbTk/Color.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Color.cc,v 1.1 2002/11/26 16:01:27 fluxgen Exp $ +// $Id: Color.cc,v 1.2 2002/11/28 19:22:40 fluxgen Exp $ #include "Color.hh" @@ -39,6 +39,7 @@ unsigned char maxValue(unsigned short colval) { }; namespace FbTk { + Color::Color(): m_allocated(false), m_screen(0) { @@ -78,10 +79,13 @@ bool Color::setFromString(const char *color_string, int screen) { XColor color; - if (! XParseColor(disp, colm, color_string, &color)) + if (! XParseColor(disp, colm, color_string, &color)) { cerr<<"FbTk::Color: Parse color error: \""<<color_string<<"\""<<endl; - else if (! XAllocColor(disp, colm, &color)) + return false; + } else if (! XAllocColor(disp, colm, &color)) { cerr<<"FbTk::Color: Allocation error: \""<<color_string<<"\""<<endl; + return false; + } -- cgit v0.11.2