From 9175b0371524f9a5f897286af64ab4af192b0efd Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Wed, 22 May 2024 15:05:56 +0200 Subject: [PATCH] Work around for scan-build false positive This results in a error: $ scan-build cmake -B build . $ scan-build --status-bugs make -C build It's a false possitive but can be fixed with this commit. --- src/binson.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/binson.cpp b/src/binson.cpp index cedfde6..9eee13e 100644 --- a/src/binson.cpp +++ b/src/binson.cpp @@ -233,8 +233,10 @@ void Binson::deseralizeItems(binson_parser *p) bbuf *buf; buf = binson_parser_get_name(p); CheckParserState(p); - ifRuntimeError(buf != nullptr, "buf is null"); - ifRuntimeError(buf->bptr != nullptr, "buf->bptr is null"); + if (buf == nullptr) + throw std::runtime_error("buf is null"); + if (buf->bptr == nullptr) + throw std::runtime_error("buf->bptr is null"); string name(reinterpret_cast(buf->bptr), buf->bsize); put(name, deseralizeItem(p)); }