add a safeguard against NULL return output stream

This commit is contained in:
Sean Middleditch 2010-01-13 18:33:19 -08:00
parent 01759517aa
commit 5a0efe6536

View File

@ -265,8 +265,10 @@ private:
// stream JSON value out
std::ostream& operator<<(std::ostream& os, const jansson::Value& value) {
char* tmp = value.save_string();
os << tmp;
free(tmp);
if (tmp != 0) {
os << tmp;
free(tmp);
}
return os;
}