13
0

make information extraction from session file options list robust against some old badly formatted session files

Fixes crash experienced by GillesM, where a rogue XML entry caused a segfault
This commit is contained in:
Paul Davis 2013-09-25 17:59:10 -04:00
parent f5cd838afc
commit e43a8dac1c

View File

@ -3784,11 +3784,20 @@ Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFo
const XMLNodeList& options (child->children());
for (XMLNodeList::const_iterator oc = options.begin(); oc != options.end(); ++oc) {
const XMLNode* option = *oc;
if (option->property("name")->value() == "native-file-data-format") {
SampleFormat fmt = (SampleFormat) string_2_enum (option->property ("value")->value(), fmt);
data_format = fmt;
found_data_format = true;
break;
const XMLProperty* name = option->property("name");
if (!name) {
continue;
}
if (name->value() == "native-file-data-format") {
const XMLProperty* value = option->property ("value");
if (value) {
SampleFormat fmt = (SampleFormat) string_2_enum (option->property ("value")->value(), fmt);
data_format = fmt;
found_data_format = true;
break;
}
}
}
}