diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index 450c7d9..f768c05 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -1774,9 +1774,13 @@ namespace Exiv2 {
     {
         try {
             // 1140
-            if( metadata->findKey(ExifKey("Exif.Image.Model"        ))->value().toString() == "Canon EOS 30D"
-            &&  metadata->findKey(ExifKey("Exif.CanonCs.Lens"       ))->value().toString() == "24 24 1"
-            &&  metadata->findKey(ExifKey("Exif.CanonCs.MaxAperture"))->value().toString() == "95" // F2.8
+            const ExifData::const_iterator itModel = metadata->findKey(ExifKey("Exif.Image.Model"));
+            const ExifData::const_iterator itLens  = metadata->findKey(ExifKey("Exif.CanonCs.Lens"));
+            const ExifData::const_iterator itApert = metadata->findKey(ExifKey("Exif.CanonCs.MaxAperture"));
+
+            if( itModel != metadata->end() && itModel->value().toString() == "Canon EOS 30D"
+            &&  itLens  != metadata->end() && itLens->value().toString() == "24 24 1"
+            &&  itApert != metadata->end() && itApert->value().toString() == "95" // F2.8
             ){
                 return os << "Canon EF-S 24mm f/2.8 STM" ;
             }
