Fix crash in ConfigCompilerContext::WriteObject

fixes #8106