avoid following null pointers
@@ -57,8 +57,12 @@ ConfigValue::getLegacyFormat() const
const vespalib::string
ConfigValue::asJson() const {
+ if (_payload) {
const vespalib::slime::Inspector & payload(_payload->getSlimePayload());
return payload.toString();
+ } else {
+ return {};
+ }
}
void
@@ -74,8 +78,10 @@ ConfigValue::serializeV1(vespalib::slime::Cursor & cursor) const
void
ConfigValue::serializeV2(vespalib::slime::Cursor & cursor) const
{
+ if (_payload) {
copySlimeObject(_payload->getSlimePayload(), cursor);
}
+}
}
