Fix edge case crash in VDF parser

Check if 'curObj' isn't nullptr.
This commit is contained in:
Kawe Mazidjatari 2023-03-19 11:25:19 +01:00
parent 180d762089
commit b33fa424b5

View File

@ -474,7 +474,7 @@ namespace vdf
continue;
// process value
if (key != TYTI_L(charT, "#include") && key != TYTI_L(charT, "#base"))
if (curObj && key != TYTI_L(charT, "#include") && key != TYTI_L(charT, "#base"))
{
curObj->add_attribute(std::move(key), std::move(value));
}
@ -538,7 +538,7 @@ namespace vdf
@param end end iterator
can thow:
- "std::runtime_error" if a parsing error occured
- "std::runtime_error" if a parsing error occurred
- "std::bad_alloc" if not enough memory coup be allocated
*/
template <typename OutputT, typename IterT>