Skip to content

Commit

Permalink
Merge pull request #75 from santeri/master
Browse files Browse the repository at this point in the history
Avoid unnecessary exceptions
  • Loading branch information
sandordargo authored Nov 28, 2024
2 parents 096f4b9 + c9c84eb commit 83065d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/spotify/json/decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ bool try_decode(
const codec_type &codec,
const char *data,
size_t size) noexcept {
if (size == 0) {
return false; // avoid exceptions below
}
try {
object = decode(codec, data, size);
return true;
Expand Down

0 comments on commit 83065d6

Please sign in to comment.