diff --git a/src/error.cpp b/src/error.cpp index faac04a3..c07626d6 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -104,7 +104,8 @@ namespace { { 48, N_("Invalid XmpText type `%1'") }, // %1=type { 49, N_("TIFF directory %1 has too many entries") }, // %1=TIFF directory name { 50, N_("Multiple TIFF array element tags %1 in one directory") }, // %1=tag number - { 51, N_("TIFF array element tag %1 has wrong type") } // %1=tag number + { 51, N_("TIFF array element tag %1 has wrong type") }, // %1=tag number + { 52, N_("%1 has invalid XMP value type `%2'") } // %1=key, %2=value type }; } diff --git a/src/xmp.cpp b/src/xmp.cpp index 3fdbb03b..9fef721e 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -651,7 +651,7 @@ namespace Exiv2 { } // Todo: Xmpdatum should have an XmpValue, not a Value const XmpValue* val = dynamic_cast(&i->value()); - assert(val); + if (val == 0) throw Error(52, i->key(), i->typeName()); options = xmpArrayOptionBits(val->xmpArrayType()) | xmpArrayOptionBits(val->xmpStruct()); if ( i->typeId() == xmpBag @@ -686,7 +686,7 @@ namespace Exiv2 { continue; } // Don't let any Xmpdatum go by unnoticed - throw Error(38, i->tagName(), TypeInfo::typeName(i->typeId())); + throw Error(38, i->tagName(), i->typeName()); } std::string tmpPacket; meta.SerializeToBuffer(&tmpPacket, xmpFormatOptionBits(static_cast(formatFlags)), padding); // throws