[gimp/metadata-browser: 3/45] Bail out if the property value is faulty.



commit 8b0c9172b6119225d03b12eeb4dd5d7baccd32f7
Author: Roman Joost <roman bromeco de>
Date:   Sun Sep 4 12:06:55 2011 +1000

    Bail out if the property value is faulty.
    
    This usually shouldn't happen, but if the value is corrupt, the
    metadata-browser shouldn't just crash.

 plug-ins/metadata/xmp-encode.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/metadata/xmp-encode.c b/plug-ins/metadata/xmp-encode.c
index 76d5617..fde07ed 100644
--- a/plug-ins/metadata/xmp-encode.c
+++ b/plug-ins/metadata/xmp-encode.c
@@ -161,6 +161,11 @@ gen_property (GString            *buffer,
                               schema->prefix, property->name);
       for (i = 0; value_array[i] != NULL; i += 2)
         {
+         if (value_array[i+1] == NULL)
+          {
+            g_printerr("Bailing out:%s:%s", schema->prefix, property->name);
+            break;
+          }
           gen_element (buffer, 4,
                        "rdf", "li", value_array[i + 1],
                        "xml:lang", value_array[i],


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