From 6e5c7efaca8c387084817cf1bea6459f5b4e03c2 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 8 Dec 2023 12:56:08 +0900 Subject: tqdesigner: prevent SEGV from invalid pointer. This resolves issue #97. Signed-off-by: Michele Calgaro Signed-off-by: ormorph --- tools/designer/designer/resource.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools/designer') 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 ) << "" << 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(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 ) << "" << endl; -- cgit v1.2.1