[gcalctool] Fix crash when not all currencies downloaded



commit 89c91934655e24a36f24ec70d6d5b79274972c6e
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Apr 20 11:51:42 2011 +1000

    Fix crash when not all currencies downloaded

 NEWS                   |    1 +
 src/currency-manager.c |    7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index ad04e76..c62d60c 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Overview of changes in gcalctool 6.1.0
       (Kjartan Maraas, Bug #646093)
     * Only write to GSettings when settings change, don't sync on exit
       (Bug #647327)
+    * Fix crash when not all currencies downloaded
 
 Overview of changes in gcalctool 6.0.0
 
diff --git a/src/currency-manager.c b/src/currency-manager.c
index 66b6c92..c7687ba 100644
--- a/src/currency-manager.c
+++ b/src/currency-manager.c
@@ -591,9 +591,12 @@ currency_manager_get_value(CurrencyManager *manager, const gchar *currency)
 
     if (!load_rates(manager))
         return NULL;
-  
+
     c = currency_manager_get_currency(manager, currency);
-    return currency_get_value(c);
+    if (c)
+        return currency_get_value(c);
+    else
+        return NULL;
 }
 
 



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