Commit 5ddbe5fa authored by Nikias Bassen's avatar Nikias Bassen

C++: Make sure String::GetValue() and Key::GetValue() don't crash with NULL strings

parent b6c43e90
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment