Skip to content

Commit

Permalink
Work around for scan-build false positive
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AndreasHansson73 authored and HRio committed May 27, 2024
1 parent f7a96ec commit e456aa1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/binson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char*>(buf->bptr), buf->bsize);
put(name, deseralizeItem(p));
}
Expand Down

0 comments on commit e456aa1

Please sign in to comment.