13
0

Fix a few unchecked XML child / property lookups

(#4814).


git-svn-id: svn://localhost/ardour2/branches/3.0@11894 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-04-11 10:51:21 +00:00
parent 86a86f482f
commit 0860570c8c
3 changed files with 24 additions and 3 deletions

View File

@ -884,7 +884,7 @@ SoundFileBrowser::freesound_search()
XMLNode *ofn_node = node->child ("original_filename");
XMLNode *dur_node = node->child ("duration");
if (id_node && uri_node && ofn_node) {
if (id_node && uri_node && ofn_node && dur_node) {
std::string id = id_node->child("text")->content();
std::string uri = uri_node->child("text")->content();

View File

@ -178,7 +178,13 @@ AudioPlaylistImporter::_prepare_move ()
}
name = rename_pair.second;
}
xml_playlist.property ("name")->set_value (name);
XMLProperty* p = xml_playlist.property ("name");
if (!p) {
error << _("badly-formed XML in imported playlist") << endmsg;
}
p->set_value (name);
handler.add_name (name);
return true;

View File

@ -223,6 +223,7 @@ AudioTrackImporter::get_info () const
return name;
}
/** @return true if everything is ok */
bool
AudioTrackImporter::_prepare_move ()
{
@ -247,7 +248,21 @@ AudioTrackImporter::_prepare_move ()
}
name = rename_pair.second;
}
xml_track.child ("IO")->property ("name")->set_value (name);
XMLNode* c = xml_track.child ("IO");
if (!c) {
error << _("badly-formed XML in imported track") << endmsg;
return false;
}
XMLProperty* p = c->property ("name");
if (!p) {
error << _("badly-formed XML in imported track") << endmsg;
return false;
}
p->set_value (name);
track_handler.add_name (name);
return true;