[gcalctool/gnome-3-2] Fix a crash in gcalctool when ECB rate file can't be parsed
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcalctool/gnome-3-2] Fix a crash in gcalctool when ECB rate file can't be parsed
- Date: Thu, 20 Oct 2011 04:16:42 +0000 (UTC)
commit dbdafca219a6e25801c19460d9f0e8277fc0a292
Author: Jeff Smith <whydoubt yahoo com>
Date: Thu Oct 20 15:16:01 2011 +1100
Fix a crash in gcalctool when ECB rate file can't be parsed
NEWS | 4 ++++
src/currency-manager.c | 9 +++++----
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0f9a8bb..53cfd7b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Overview of changes in gcalctool 6.2.1
+
+ * Fix a crash in gcalctool when ECB rate file can't be parsed
+
Overview of changes in gcalctool 6.2.0
* Updated translations
diff --git a/src/currency-manager.c b/src/currency-manager.c
index 0ae07ab..6086b35 100644
--- a/src/currency-manager.c
+++ b/src/currency-manager.c
@@ -469,7 +469,7 @@ static void
load_ecb_rates(CurrencyManager *manager)
{
Currency *eur_rate;
- char *filename = get_ecb_rate_filepath();
+ char *filename;
xmlDocPtr document;
xmlXPathContextPtr xpath_ctx;
xmlXPathObjectPtr xpath_obj;
@@ -487,12 +487,13 @@ load_ecb_rates(CurrencyManager *manager)
set_ecb_fixed_rate(manager, "CFA", "0.152449", eur_rate);
xmlInitParser();
+ filename = get_ecb_rate_filepath();
document = xmlReadFile(filename, NULL, 0);
- g_free (filename);
- if (document == NULL) {
+ if (!document)
g_error("Couldn't parse ECB rate file %s", filename);
+ g_free (filename);
+ if (!document)
return;
- }
xpath_ctx = xmlXPathNewContext(document);
if (xpath_ctx == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]