diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-12-08 12:56:08 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-12-08 13:12:01 +0900 |
commit | 6e5c7efaca8c387084817cf1bea6459f5b4e03c2 (patch) | |
tree | a2e0cc5ddda2d771f9eb2cb07366b15c1e9685c9 | |
parent | ee0c5d5840f5444e2b0363336a04764cbeb840eb (diff) | |
download | tqt3-6e5c7efaca8c387084817cf1bea6459f5b4e03c2.tar.gz tqt3-6e5c7efaca8c387084817cf1bea6459f5b4e03c2.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.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/designer/designer/resource.cpp b/tools/designer/designer/resource.cpp index ef1b39e9e..9818bd280 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; |