summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-12-08 12:56:08 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-12-08 13:12:01 +0900
commit6e5c7efaca8c387084817cf1bea6459f5b4e03c2 (patch)
treea2e0cc5ddda2d771f9eb2cb07366b15c1e9685c9
parentee0c5d5840f5444e2b0363336a04764cbeb840eb (diff)
downloadtqt3-6e5c7efa.tar.gz
tqt3-6e5c7efa.zip
tqdesigner: prevent SEGV from invalid pointer. This resolves issue #97.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> Signed-off-by: ormorph <roma251078@mail.ru>
-rw-r--r--tools/designer/designer/resource.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/designer/designer/resource.cpp b/tools/designer/designer/resource.cpp
index ef1b39e9..9818bd28 100644
--- a/tools/designer/designer/resource.cpp
+++ b/tools/designer/designer/resource.cpp
@@ -1247,7 +1247,10 @@ void Resource::saveItems( TQObject *obj, TQTextStream &ts, int indent )
indent--;
ts << makeIndent( indent ) << "</column>" << endl;
}
- saveItem( lv->firstChild(), ts, indent - 1 );
+ if (lv->firstChild())
+ {
+ saveItem( lv->firstChild(), ts, indent - 1 );
+ }
}
#if !defined (TQT_NO_TABLE)
else if ( ::tqt_cast<TQTable*>(obj) ) {
@@ -1307,6 +1310,11 @@ void Resource::saveItems( TQObject *obj, TQTextStream &ts, int indent )
void Resource::saveItem( TQListViewItem *i, TQTextStream &ts, int indent )
{
+ if (!i)
+ {
+ return;
+ }
+
TQListView *lv = i->listView();
while ( i ) {
ts << makeIndent( indent ) << "<item>" << endl;