From 3c3ba9ef4c65926b632c8460e186da9786ec96c9 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Thu, 7 Feb 2013 03:13:08 -0200 Subject: [PATCH] Fix crash when clientid is invalid --- src/client/thing.h | 2 ++ src/client/uiitem.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/thing.h b/src/client/thing.h index 03934250..24815d1e 100644 --- a/src/client/thing.h +++ b/src/client/thing.h @@ -59,6 +59,8 @@ public: virtual bool isAnimatedText() { return false; } virtual bool isStaticText() { return false; } + virtual bool isValid() { return rawGetThingType() != nullptr; } + // type shortcuts virtual const ThingTypePtr& getThingType(); virtual ThingType *rawGetThingType(); diff --git a/src/client/uiitem.cpp b/src/client/uiitem.cpp index eb062013..fdd700a2 100644 --- a/src/client/uiitem.cpp +++ b/src/client/uiitem.cpp @@ -44,7 +44,7 @@ void UIItem::drawSelf(Fw::DrawPane drawPane) drawImage(m_rect); - if(m_itemVisible && m_item) { + if(m_itemVisible && m_item && m_item->isValid()) { Rect drawRect = getPaddingRect(); Point dest = drawRect.bottomRight() + Point(1,1);