gnucash master: Fix crash from dereferencing nullptr when TZ isn't set.
John Ralls
jralls at code.gnucash.org
Mon Sep 26 11:56:44 EDT 2016
Updated via https://github.com/Gnucash/gnucash/commit/081d6ec0 (commit)
from https://github.com/Gnucash/gnucash/commit/9fc6119d (commit)
commit 081d6ec037649427adb2f98032e92f87346182cf
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Sep 26 17:55:45 2016 +0200
Fix crash from dereferencing nullptr when TZ isn't set.
diff --git a/src/libqof/qof/gnc-timezone.cpp b/src/libqof/qof/gnc-timezone.cpp
index 45f9a60..46a7ca9 100644
--- a/src/libqof/qof/gnc-timezone.cpp
+++ b/src/libqof/qof/gnc-timezone.cpp
@@ -353,8 +353,9 @@ namespace IANAParser
std::ifstream ifs;
auto tzname = name;
if (tzname.empty())
- tzname = std::string(std::getenv("TZ"));
- std::cout << "Testing tzname " << tzname << "\n";
+ if (auto tzenv = getenv("TZ"))
+ tzname = std::string(std::getenv("TZ"));
+ //std::cout << "Testing tzname " << tzname << "\n";
if (tzname.empty())
{
ifs.open("/etc/localtime",
Summary of changes:
src/libqof/qof/gnc-timezone.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list