summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-12-08 13:05:13 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-12-08 13:08:43 +0900
commit30ac86e18cc775007edbbf3cdb816082c172f38c (patch)
tree3f24878bf63c3bb7a6569334bddbabf6a5f9c008
parent0ac52a652e631e24ac4989414b2c27b7b55ec239 (diff)
downloadtdevelop-30ac86e18cc775007edbbf3cdb816082c172f38c.tar.gz
tdevelop-30ac86e18cc775007edbbf3cdb816082c172f38c.zip
kdevdesigner: prevent SEGV from invalid pointer. This relates to issue TDE/tqt3#97
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--kdevdesigner/designer/resource.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/kdevdesigner/designer/resource.cpp b/kdevdesigner/designer/resource.cpp
index 48da59b4..d4099e34 100644
--- a/kdevdesigner/designer/resource.cpp
+++ b/kdevdesigner/designer/resource.cpp
@@ -1220,7 +1220,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) ) {
@@ -1280,6 +1283,10 @@ 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;