Fix for [Bug with exempi 2.5.0 #1]

With exempi 2.5.0 when the get_property was called on an unset one, it
crashed with "unkown error".

Fix with checking if property exists before actually getting the
property
This commit is contained in:
2019-04-01 20:58:45 +09:00
parent 217cd87feb
commit 19a8c2b997

View File

@@ -1102,7 +1102,11 @@ for xmp_file in work_files:
# read fields from the XMP file and store in hash
xmp.parse_from_str(strbuffer)
for xmp_field in xmp_fields:
# need to check if propert exist or it will the exempi routine will fail
if xmp.does_property_exist(xmp_fields[xmp_field], xmp_field):
data_set[xmp_field] = xmp.get_property(xmp_fields[xmp_field], xmp_field)
else:
data_set[xmp_field] = ''
if args.debug:
print("### => XMP: {}:{} => {}".format(xmp_fields[xmp_field], xmp_field, data_set[xmp_field]))
if args.read_only: