all repos — fluxbox @ baa6a4a42ffead3ed8db11fd84d69706e98b2df7

custom fork of the fluxbox windowmanager

fixed checking in ThemeItem int
fluxgen fluxgen
commit

baa6a4a42ffead3ed8db11fd84d69706e98b2df7

parent

7c11f8b5931e87d11b177bee7b0e10f3fad33f72

1 files changed, 14 insertions(+), 5 deletions(-)

jump to
M src/FbTk/ThemeItems.hhsrc/FbTk/ThemeItems.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ThemeItems.hh,v 1.3 2003/11/28 23:02:05 fluxgen Exp $ +// $Id: ThemeItems.hh,v 1.4 2004/01/02 21:59:52 fluxgen Exp $ /// @file implements common theme items

@@ -64,9 +64,13 @@ }

template <> void FbTk::ThemeItem<int>::setFromString(const char *str) { - if (str == 0) + if (str == 0) { + setDefaultValue(); return; - sscanf(str, "%d", &m_value); + } + + if (sscanf(str, "%d", &m_value) < 1) + setDefaultValue(); } template <>

@@ -124,16 +128,21 @@ m_value.colorTo().setFromString("white", m_tm.screenNum());

StringUtil::removeFirstWhitespace(pixmap_name); StringUtil::removeTrailingWhitespace(pixmap_name); - + if (pixmap_name.empty()) { + m_value.pixmap() = 0; + return; + } std::auto_ptr<PixmapWithMask> pm(Image::load(pixmap_name, m_tm.screenNum())); if (pm.get() == 0) { - if (FbTk::ThemeManager::instance().verbose()) + if (FbTk::ThemeManager::instance().verbose()) { cerr<<"Resource("<<name()+".pixmap" <<"): Failed to load image: "<<pixmap_name<<endl; + } m_value.pixmap() = 0; } else m_value.pixmap() = pm->pixmap().release(); + } template <>