From 15f6a2cfe430836e78bd4e8dfce808049f956be5 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Mon, 20 Dec 2021 13:44:44 +0000 Subject: [PATCH] Fix bug in loop. It wasn't iterating over the elements of dateStrings as intended. --- samples/geotag.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/geotag.cpp b/samples/geotag.cpp index dbbfe25995..52cd22aac2 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -636,9 +636,9 @@ time_t readImageTime(const std::string& path,std::string* pS=NULL) , "Exif.Image.DateTime" , NULL }; - const char* dateString = dateStrings[0] ; - do { + for (size_t i = 0; !result && dateStrings[i]; i++) { + const char* dateString = dateStrings[i] ; try { Image::AutoPtr image = ImageFactory::open(path); if ( image.get() ) { @@ -649,7 +649,7 @@ time_t readImageTime(const std::string& path,std::string* pS=NULL) if ( result && pS ) *pS = exifData[dateString].toString(); } } catch ( ... ) {}; - } while ( !result && ++dateString ); + } return result ; }