13
0

fix crash when setting an LV2 preset that refers to ports via incorrect names (from bazz)

git-svn-id: svn://localhost/ardour2/branches/3.0@11719 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-03-17 12:28:37 +00:00
parent 377f407a2f
commit 5aec73971a

View File

@ -723,6 +723,8 @@ LV2Plugin::load_preset(PresetRecord r)
{
Plugin::load_preset(r);
std::map<std::string,uint32_t>::iterator it;
LilvNode* lv2_port = lilv_new_uri(_world.world, LILV_NS_LV2 "port");
LilvNode* lv2_symbol = lilv_new_uri(_world.world, LILV_NS_LV2 "symbol");
LilvNode* oldpset_value = lilv_new_uri(_world.world, NS_OLDPSET "value");
@ -738,8 +740,9 @@ LV2Plugin::load_preset(PresetRecord r)
value = get_value(_world.world, port, oldpset_value);
}
if (value && lilv_node_is_float(value)) {
set_parameter(_port_indices[lilv_node_as_string(symbol)],
lilv_node_as_float(value));
it = _port_indices.find(lilv_node_as_string(symbol));
if (it != _port_indices.end())
set_parameter(it->second,lilv_node_as_float(value));
}
}
lilv_nodes_free(ports);