[gthumb/gthumb-3-0] exiv2: fixed crash if the metadata is NULL



commit 1f9456d369c25e46eb2b199a3cb773505f372c9b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Aug 21 13:37:29 2012 +0200

    exiv2: fixed crash if the metadata is NULL

 extensions/exiv2_tools/exiv2-utils.cpp |   39 +++++++++++++++++--------------
 1 files changed, 21 insertions(+), 18 deletions(-)
---
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index a38ab08..a17b5ac 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -659,9 +659,10 @@ exiv2_read_metadata (Exiv2::Image::AutoPtr  image,
 						    raw_value.str().c_str(),
 						    "Iptc",
 						    md->typeName());
-
-			add_metadata_to_hash (table, metadata);
-			_g_object_unref (metadata);
+			if (metadata != NULL) {
+				add_metadata_to_hash (table, metadata);
+				g_object_unref (metadata);
+			}
 		}
 
 		set_file_info_from_hash (info, table);
@@ -690,15 +691,16 @@ exiv2_read_metadata (Exiv2::Image::AutoPtr  image,
 						    raw_value.str().c_str(),
 						    "Xmp::Embedded",
 						    md->typeName());
+			if (metadata != NULL) {
+				if ((g_strcmp0 (md->typeName(), "XmpBag") == 0)
+				    || (g_strcmp0 (md->typeName(), "XmpSeq") == 0))
+				{
+					add_string_list_to_metadata (metadata, *md);
+				}
 
-			if ((g_strcmp0 (md->typeName(), "XmpBag") == 0)
-			    || (g_strcmp0 (md->typeName(), "XmpSeq") == 0))
-			{
-				add_string_list_to_metadata (metadata, *md);
+				add_metadata_to_hash (table, metadata);
+				g_object_unref (metadata);
 			}
-
-			add_metadata_to_hash (table, metadata);
-			_g_object_unref (metadata);
 		}
 
 		set_file_info_from_hash (info, table);
@@ -847,15 +849,16 @@ exiv2_read_sidecar (GFile     *file,
 							    raw_value.str().c_str(),
 							    "Xmp::Sidecar",
 							    md->typeName());
+				if (metadata != NULL) {
+					if ((g_strcmp0 (md->typeName(), "XmpBag") == 0)
+					    || (g_strcmp0 (md->typeName(), "XmpSeq") == 0))
+					{
+						add_string_list_to_metadata (metadata, *md);
+					}
 
-				if ((g_strcmp0 (md->typeName(), "XmpBag") == 0)
-				    || (g_strcmp0 (md->typeName(), "XmpSeq") == 0))
-				{
-					add_string_list_to_metadata (metadata, *md);
+					add_metadata_to_hash (table, metadata);
+					g_object_unref (metadata);
 				}
-
-				add_metadata_to_hash (table, metadata);
-				_g_object_unref (metadata);
 			}
 
 			set_file_info_from_hash (info, table);



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