From 1a2779990a777715147df788524ace70ea88c822 Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Sat, 5 May 2007 23:15:05 +0000
Subject: checking some return values

---
 src/FbTk/FbWindow.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 926abfd..450ca32 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -465,7 +465,7 @@ void FbWindow::reparent(const FbWindow &parent, int x, int y, bool continuing) {
 std::string FbWindow::textProperty(Atom property) const {
     XTextProperty text_prop;
     char ** stringlist = 0;
-    int count;
+    int count = 0;
     std::string ret;
 
     static Atom m_utf8string = XInternAtom(display(), "UTF8_STRING", False);
@@ -483,16 +483,17 @@ std::string FbWindow::textProperty(Atom property) const {
     } else if (text_prop.encoding == m_utf8string && text_prop.format == 8) {
 #ifdef X_HAVE_UTF8_STRING
         Xutf8TextPropertyToTextList(display(), &text_prop, &stringlist, &count);
-        if (count == 0)
+        if (count == 0 || stringlist == 0)
             return "";
 #else
-        if (XTextPropertyToStringList(&text_prop, &stringlist, &count) == 0 || count == 0)
+        if (XTextPropertyToStringList(&text_prop, &stringlist, &count) == 0 || count == 0 || stringlist == 0)
             return "";
 #endif
         ret = stringlist[0];
     } else {
         // still returns a "StringList" despite the different name
-        if (XmbTextPropertyToTextList(display(), &text_prop, &stringlist, &count) == 0 || count == 0)
+        XmbTextPropertyToTextList(display(), &text_prop, &stringlist, &count);
+        if (count == 0 || stringlist == 0)
             return "";
 
         ret = FbStringUtil::LocaleStrToFb(stringlist[0]);
-- 
cgit v0.11.2