Skip to content

Commit

Permalink
handle unknown json::value_t kinds (by aborting)
Browse files Browse the repository at this point in the history
This should prevent a compile warning when building against nlohmann json.hpp
v3.8.0 or greater, which add an extra value_t kind for binary data.
  • Loading branch information
johnbartholomew committed Mar 6, 2024
1 parent e359e46 commit 5cd4c26
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,14 @@ class Interpreter {
case json::value_t::discarded: {
abort();
}

default: {
// Newer mlohmann json.hpp (from v3.8.0 https://github.com/nlohmann/json/pull/1662)
// add a `value_t::binary` type, used when dealing with some JSON-adjacent binary
// formats (BSON, CBOR, etc). Since it doesn't exist prior to v3.8.0 we can't match
// on it explicitly, but we can just treat any unknown type as an error.
abort();
}
}
}

Expand Down

0 comments on commit 5cd4c26

Please sign in to comment.