diff options
author | fluxgen <fluxgen> | 2002-11-28 19:22:40 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-11-28 19:22:40 (GMT) |
commit | 5cef8b6505b69c4c69446fec29666c42f57cf5e5 (patch) | |
tree | bb093f18aef99cf0c5c30b7ca597efb9fce78cd4 | |
parent | a4668b0772d6797a42ceec9901ee18379f27a56d (diff) | |
download | fluxbox_paul-5cef8b6505b69c4c69446fec29666c42f57cf5e5.zip fluxbox_paul-5cef8b6505b69c4c69446fec29666c42f57cf5e5.tar.bz2 |
return false if we cant parse nor allocate color string
-rw-r--r-- | src/FbTk/Color.cc | 10 |
1 files 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 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: Color.cc,v 1.1 2002/11/26 16:01:27 fluxgen Exp $ | 22 | // $Id: Color.cc,v 1.2 2002/11/28 19:22:40 fluxgen Exp $ |
23 | 23 | ||
24 | #include "Color.hh" | 24 | #include "Color.hh" |
25 | 25 | ||
@@ -39,6 +39,7 @@ unsigned char maxValue(unsigned short colval) { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | namespace FbTk { | 41 | namespace FbTk { |
42 | |||
42 | Color::Color(): | 43 | Color::Color(): |
43 | m_allocated(false), | 44 | m_allocated(false), |
44 | m_screen(0) { | 45 | m_screen(0) { |
@@ -78,10 +79,13 @@ bool Color::setFromString(const char *color_string, int screen) { | |||
78 | 79 | ||
79 | XColor color; | 80 | XColor color; |
80 | 81 | ||
81 | if (! XParseColor(disp, colm, color_string, &color)) | 82 | if (! XParseColor(disp, colm, color_string, &color)) { |
82 | cerr<<"FbTk::Color: Parse color error: \""<<color_string<<"\""<<endl; | 83 | cerr<<"FbTk::Color: Parse color error: \""<<color_string<<"\""<<endl; |
83 | else if (! XAllocColor(disp, colm, &color)) | 84 | return false; |
85 | } else if (! XAllocColor(disp, colm, &color)) { | ||
84 | cerr<<"FbTk::Color: Allocation error: \""<<color_string<<"\""<<endl; | 86 | cerr<<"FbTk::Color: Allocation error: \""<<color_string<<"\""<<endl; |
87 | return false; | ||
88 | } | ||
85 | 89 | ||
86 | 90 | ||
87 | 91 | ||