From dc1d9c837b0ca5ae02374ab35b4f7c373f77006b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 6 Feb 2023 17:10:29 +0000 Subject: [PATCH] Fix crashing when encountering an unterminated commented block. --- src/config.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config.cpp b/src/config.cpp index 432e1001f..bd9bebe5c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -943,5 +943,10 @@ void Conf::LoadConf(File &file) if (!itemname.empty() || !wordbuffer.empty()) throw ConfigException("Unexpected garbage at end of file: " + file.GetName()); if (!block_stack.empty()) - throw ConfigException("Unterminated block at end of file: " + file.GetName() + ". Block was opened on line " + stringify(block_stack.top()->linenum)); + { + if (block_stack.top()) + throw ConfigException("Unterminated block at end of file: " + file.GetName() + ". Block was opened on line " + stringify(block_stack.top()->linenum)); + else + throw ConfigException("Unterminated commented block at end of file: " + file.GetName()); + } }