diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Key.cpp | 9 | ||||
-rw-r--r-- | src/String.cpp | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/Key.cpp b/src/Key.cpp index e3ccbe6..ed0c0c6 100644 --- a/src/Key.cpp +++ b/src/Key.cpp @@ -67,8 +67,13 @@ std::string Key::GetValue() const { char* s = NULL; plist_get_key_val(_node, &s); - std::string ret = s; - free(s); + std::string ret; + if (s) { + ret = s; + free(s); + } else { + ret = ""; + } return ret; } diff --git a/src/String.cpp b/src/String.cpp index 09b47b5..0965349 100644 --- a/src/String.cpp +++ b/src/String.cpp @@ -67,8 +67,13 @@ std::string String::GetValue() const { char* s = NULL; plist_get_string_val(_node, &s); - std::string ret = s; - free(s); + std::string ret; + if (s) { + ret = s; + free(s); + } else { + ret = ""; + } return ret; } |