[evolution] ESourceSelector: Fix a potential runtime warning.



commit 671ba19294ca66e5ebedf87eee6c3d486bb244a8
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Oct 19 11:55:55 2013 -0400

    ESourceSelector: Fix a potential runtime warning.
    
    When (re)building the tree model, ESourceSelector may fall back to
    e_source_registry_ref_default_for_extension_name() to help initialize
    the primary selection.  Depending on the selector's "extension-name"
    property, that function may return NULL.  Handle it gracefully.

 e-util/e-source-selector.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-source-selector.c b/e-util/e-source-selector.c
index e84566d..b4f82c2 100644
--- a/e-util/e-source-selector.c
+++ b/e-util/e-source-selector.c
@@ -366,9 +366,11 @@ source_selector_build_model (ESourceSelector *selector)
        if (selected == NULL) {
                selected = e_source_registry_ref_default_for_extension_name (
                        registry, extension_name);
+       }
+       if (selected != NULL) {
                e_source_selector_set_primary_selection (selector, selected);
+               g_object_unref (selected);
        }
-       g_object_unref (selected);
 }
 
 static void


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