0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-16 08:58:20 +02:00

ircd::json: Antipodal undefined number; add assert that it's not zero.

This commit is contained in:
Jason Volk 2018-05-23 00:29:26 -07:00
parent 67ddd4bf87
commit f641076072
2 changed files with 7 additions and 2 deletions

View file

@ -1736,9 +1736,14 @@ const ircd::string_view ircd::json::empty_array { "[]" };
decltype(ircd::json::undefined_number)
ircd::json::undefined_number
{
std::numeric_limits<decltype(ircd::json::undefined_number)>::max()
std::numeric_limits<decltype(ircd::json::undefined_number)>::min()
};
static_assert
(
ircd::json::undefined_number != 0
);
std::ostream &
ircd::json::operator<<(std::ostream &s, const value &v)
{

View file

@ -1760,7 +1760,7 @@ ircd::m::event::conforms::conforms(const event &e)
if(empty(json::get<"prev_state"_>(e)))
set(MISSING_PREV_STATE);
if(json::get<"depth"_>(e) < 0)
if(json::get<"depth"_>(e) != json::undefined_number && json::get<"depth"_>(e) < 0)
set(DEPTH_NEGATIVE);
if(json::get<"type"_>(e) != "m.room.create")