summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2023-02-06 17:10:29 +0000
committerSadie Powell <sadie@witchery.services>2023-02-06 17:10:29 +0000
commitdc1d9c837b0ca5ae02374ab35b4f7c373f77006b (patch)
tree16f4c1d76382de8a8e43f1ba97d14b3036131726
parent33a337dfc051222041896ec3ac349fd2f4821777 (diff)
Fix crashing when encountering an unterminated commented block.
-rw-r--r--src/config.cpp7
1 files changed, 6 insertions, 1 deletions
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());
+ }
}