Explicitly initialise optionals in Subschema class

This commit is contained in:
Tristan Penman 2021-05-20 16:07:07 +10:00
parent cb778b6bb6
commit 3740dc5166

View File

@ -63,7 +63,13 @@ public:
Subschema(CustomAlloc allocFn, CustomFree freeFn)
: m_allocFn(allocFn)
, m_freeFn(freeFn)
, m_alwaysInvalid(false) { }
, m_alwaysInvalid(false)
{
// explicitly initialise optionals. See: https://github.com/tristanpenman/valijson/issues/124
m_description = opt::nullopt;
m_id = opt::nullopt;
m_title = opt::nullopt;
}
/**
* @brief Clean up and free all memory managed by the Subschema