From cde7aeac3ddd97d5e553c064034bb7b55555a66d Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 20 May 2023 19:33:14 +0200 Subject: [PATCH] Replace an `asert` with a conditional throw The assert is reachable, resulting in a brutal `abort` instead of a nice exception. --- components/esm4/reader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esm4/reader.cpp b/components/esm4/reader.cpp index 18f5cddadf..d2c77919d2 100644 --- a/components/esm4/reader.cpp +++ b/components/esm4/reader.cpp @@ -686,7 +686,8 @@ namespace ESM4 { char ch; stream.read(&ch, 1); // read the null terminator - assert(ch == '\0' && "ESM4::Reader::getString string is not terminated with a null"); + if (ch != '\0') + throw std::runtime_error("ESM4::Reader::getString string is not terminated with a null"); } #if 0 else