[template-glib] template: add fallback error warning



commit f516531497923d19e9e1e47f00d11b7e78ac46be
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 9 12:22:53 2016 -0700

    template: add fallback error warning
    
    Ensures that we never return NULL without a proper error being set.

 src/tmpl-template.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/tmpl-template.c b/src/tmpl-template.c
index e666898..e85dcab 100644
--- a/src/tmpl-template.c
+++ b/src/tmpl-template.c
@@ -509,6 +509,13 @@ tmpl_template_expand_string (TmplTemplate  *self,
 
     {
       g_object_unref (stream);
+
+      if (error != NULL && *error == NULL)
+        g_set_error (error,
+                     G_IO_ERROR,
+                     G_IO_ERROR_UNKNOWN,
+                     "An unknown error occurred while expanding the template");
+
       return NULL;
     }
 


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