From 595454f39fc268dc4ab8a4ffbb53bbab95b878bf Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Sun, 26 Jun 2005 11:04:27 +0000 Subject: [PATCH] Fixed ExifTags::printTag to call the print function only if there is at least one component in the value. Fixes bug #433. Fixed printLong print function to survive if the value is a Rational with a 0 denominator. --- src/tags.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tags.cpp b/src/tags.cpp index 08eaf2aa..d129ab1f 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -507,6 +507,7 @@ namespace Exiv2 { IfdId ifdId, const Value& value) { + if (value.count() == 0) return os; PrintFct fct = printValue; if (isExifIfd(ifdId)) { int idx = tagInfoIdx(tag, ifdId); @@ -734,8 +735,10 @@ namespace Exiv2 { std::ostream& printLong(std::ostream& os, const Value& value) { - return os << value.toLong(); - } + Rational r = value.toRational(); + if (r.second != 0) return os << static_cast(r.first) / r.second; + return os << "(" << value << ")"; + } // printLong std::ostream& printFloat(std::ostream& os, const Value& value) {