From cde75530fed84f7236d41e196eef77b2820f32f6 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 15 Jul 2021 08:43:31 +0100 Subject: [PATCH] =?UTF-8?q?BTG=20reading:=20don=E2=80=99t=20crash=20on=20e?= =?UTF-8?q?mpty=20error=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sentry-Id:FLIGHTGEAR-WA8 --- simgear/io/lowlevel.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simgear/io/lowlevel.cxx b/simgear/io/lowlevel.cxx index 9ae5bb42..52852b57 100644 --- a/simgear/io/lowlevel.cxx +++ b/simgear/io/lowlevel.cxx @@ -48,9 +48,11 @@ static std::string gzErrorMessage(gzFile fd) if (errNum == Z_ERRNO) { return simgear::strutils::error_string(errno); - } else { + } else if (gzMsg) { return {gzMsg}; } + + return {"GZError: no string code for code:" + std::to_string(errNum)}; } void sgReadChar ( gzFile fd, char *var )