@@ -31,11 +31,12 @@ void TIFFImagePyramidImporter::execute() {
3131 bool isOMETiff = false ;
3232 TIFFSetDirectory (tiff, 0 );
3333 // Read description to check if image is OME-TIFF
34- char * description;
35- int result = TIFFGetField (tiff, TIFFTAG_IMAGEDESCRIPTION, &description);
34+ char * descriptionChar;
35+ int result = TIFFGetField (tiff, TIFFTAG_IMAGEDESCRIPTION, &descriptionChar);
36+ std::string description;
3637 if (result == 1 ) { // Must check if tag exists
37- std::string str = description ;
38- if (str .find (" xml" ) != std::string::npos && str .find (" OME" ) != std::string::npos) {
38+ description = descriptionChar ;
39+ if (description .find (" xml" ) != std::string::npos && description .find (" OME" ) != std::string::npos) {
3940 reportInfo () << " TIFF file seems to be an OME-TIFF, reading it as such.." << reportEnd ();
4041 isOMETiff = true ;
4142 }
@@ -99,8 +100,10 @@ void TIFFImagePyramidImporter::execute() {
99100 std::string str = description;
100101 magnification = 0 .0f ;
101102 while (std::regex_search (str, match, pattern)) {
102- if (std::stof (match[1 ]) > magnification) { // Get largest magnification
103- magnification = std::stof (match[1 ]);
103+ if (match.size () >= 2 ) {
104+ if (std::stof (match[1 ]) > magnification) { // Get largest magnification
105+ magnification = std::stof (match[1 ]);
106+ }
104107 }
105108 str = match.suffix ();
106109 }
0 commit comments