apavlenko / vmf

http://01org.github.io/vmf/
Apache License 2.0
0 stars 3 forks source link

Impossible to get value of single-value metadata #29

Closed savuor closed 8 years ago

savuor commented 8 years ago

The following code produces exception:

std::shared_ptr<vmf::MetadataDesc> desc(new vmf::MetadataDesc(name, type));
std::shared_ptr<vmf::Metadata> metadata(new vmf::Metadata(desc));
metadata->addValue(value);
metadata->getFieldValue("");

where name, type and value are respectively any allowed:

The reason is that creating single-value descriptions is possible, but accessing the (only) field of metadata based on them is impossible. The exception is thrown at the following string:

vmf::Variant Metadata::getFieldValue( const std::string& sName ) const
{
    if( sName.empty() )
    {
        VMF_EXCEPTION(IncorrectParamException, "Field name not specified!");
...
savuor commented 8 years ago

Fix added: #31