Skip to content

Commit 5cd4c26

Browse files
handle unknown json::value_t kinds (by aborting)
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.
1 parent e359e46 commit 5cd4c26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/vm.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,14 @@ class Interpreter {
17151715
case json::value_t::discarded: {
17161716
abort();
17171717
}
1718+
1719+
default: {
1720+
// Newer mlohmann json.hpp (from v3.8.0 https://github.com/nlohmann/json/pull/1662)
1721+
// add a `value_t::binary` type, used when dealing with some JSON-adjacent binary
1722+
// formats (BSON, CBOR, etc). Since it doesn't exist prior to v3.8.0 we can't match
1723+
// on it explicitly, but we can just treat any unknown type as an error.
1724+
abort();
1725+
}
17181726
}
17191727
}
17201728

0 commit comments

Comments
 (0)