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 16:21:04 +0900 |
commit | a059b24f5a887ee22df93d962eb90d79c7ce4ded (patch) | |
tree | 7a733e05bb7a88a1eba199e4bf4ae68e076d67f5 | |
parent | ccc0d8e4efbe32950a9cb8cfd60e981cc7347b67 (diff) | |
download | tqt3-a059b24f5a887ee22df93d962eb90d79c7ce4ded.tar.gz tqt3-a059b24f5a887ee22df93d962eb90d79c7ce4ded.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>
(cherry picked from commit 6e5c7efaca8c387084817cf1bea6459f5b4e03c2)
-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; |