[gexiv2] Consider 0 numerator as 0, not invalid fraction



commit 403d5776fcb05d0894b470e68aec377e12aff4f7
Author: Jens Georg <mail jensge org>
Date:   Mon Mar 20 12:08:09 2017 +0100

    Consider 0 numerator as 0, not invalid fraction
    
    Signed-off-by: Jens Georg <mail jensge org>

 gexiv2/gexiv2-metadata-exif.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gexiv2/gexiv2-metadata-exif.cpp b/gexiv2/gexiv2-metadata-exif.cpp
index 8084575..d7e20ad 100644
--- a/gexiv2/gexiv2-metadata-exif.cpp
+++ b/gexiv2/gexiv2-metadata-exif.cpp
@@ -251,6 +251,10 @@ gdouble gexiv2_metadata_get_exif_tag_rational_as_double (GExiv2Metadata *self, c
     if (!gexiv2_metadata_get_exif_tag_rational(self, tag, &nom, &den))
         return def;
     
+    if (nom == 0.0) {
+        return 0.0;
+    }
+
     return (den != 0.0) ? (double) nom / (double) den : def;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]