diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index 42a076e940..9998614565 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -1670,10 +1670,10 @@ namespace Exiv2 { } // TiffParserWorker::parse - void TiffParserWorker::findPrimaryGroups(PrimaryGroups& primaryGroups, - TiffComponent* pSourceDir) + void TiffParserWorker::findPrimaryGroups(PrimaryGroups& primaryGroups, TiffComponent* pSourceDir) { - if (0 == pSourceDir) return; + if (0 == pSourceDir) + return; const IfdId imageGroups[] = { ifd0Id, @@ -1695,10 +1695,8 @@ namespace Exiv2 { TiffFinder finder(0x00fe, imageGroups[i]); pSourceDir->accept(finder); TiffEntryBase* te = dynamic_cast(finder.result()); - if ( te - && te->pValue()->typeId() == unsignedLong - && te->pValue()->count() == 1 - && (te->pValue()->toLong() & 1) == 0) { + const Value* pV = te != NULL ? te->pValue() : NULL; + if (pV && pV->typeId() == unsignedLong && pV->count() == 1 && (pV->toLong() & 1) == 0) { primaryGroups.push_back(te->group()); } }