From 730591e7cd941982a80b5fa02c81f2e33751cbce Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 28 Jul 2008 08:03:29 +0000 Subject: [PATCH] fixed some segfaults in case of invalid objects in object-vector git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1388 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/automation_pattern.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index 9052e983ac..a269eced32 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -277,9 +277,12 @@ void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this ) for( objectVector::const_iterator it = m_objects.begin(); it != m_objects.end(); ++it ) { - QDomElement element = _doc.createElement( "object" ); - element.setAttribute( "id", ( *it )->id() ); - _this.appendChild( element ); + if( *it != NULL ) + { + QDomElement element = _doc.createElement( "object" ); + element.setAttribute( "id", ( *it )->id() ); + _this.appendChild( element ); + } } } @@ -337,7 +340,7 @@ const QString automationPattern::name( void ) const { return( trackContentObject::name() ); } - if( !m_objects.isEmpty() ) + if( !m_objects.isEmpty() && m_objects.first() != NULL ) { return( m_objects.first()->fullDisplayName() ); }