ZynAddSubFX: check whether QDomDocument::setContent() succeeded

When saving settings in ZynAddSubFxInstrument::saveSettings() check
whether the call to QDomDocument::setContent() succeeded. Otherwise
LMMS crashes when calling QDomDocument::importNode() later due to a bug
in QtXml.

Fixes crash in the unlikely situation that transmission of XML data from
the ZynAddSubFX plugin to LMMS somehow failed.
This commit is contained in:
Tobias Doerffel
2010-07-25 20:47:04 +02:00
parent c6640ffd37
commit eaebe3cb84

View File

@@ -158,9 +158,11 @@ void ZynAddSubFxInstrument::saveSettings( QDomDocument & _doc,
m_pluginMutex.unlock();
QByteArray a = tf.readAll();
QDomDocument doc( "mydoc" );
doc.setContent( a );
QDomNode n = _doc.importNode( doc.documentElement(), true );
_this.appendChild( n );
if( doc.setContent( a ) )
{
QDomNode n = _doc.importNode( doc.documentElement(), true );
_this.appendChild( n );
}
}
}