Skip to content

Commit 9fdc337

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 955ffe6 commit 9fdc337

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
@@ -1711,6 +1711,14 @@ class Interpreter {
17111711
case json::value_t::discarded: {
17121712
abort();
17131713
}
1714+
1715+
default: {
1716+
// Newer mlohmann json.hpp (from v3.8.0 https://github.com/nlohmann/json/pull/1662)
1717+
// add a `value_t::binary` type, used when dealing with some JSON-adjacent binary
1718+
// formats (BSON, CBOR, etc). Since it doesn't exist prior to v3.8.0 we can't match
1719+
// on it explicitly, but we can just treat any unknown type as an error.
1720+
abort();
1721+
}
17141722
}
17151723
}
17161724

0 commit comments

Comments
 (0)