0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-28 17:52:54 +01:00

ircd::db: Assert valid iterator prior to all relevant operations.

This commit is contained in:
Jason Volk 2023-04-15 15:12:27 -07:00
parent 73a3a4cb35
commit 6e7d63ce6d

View file

@ -5179,11 +5179,24 @@ ircd::db::_seek_(rocksdb::Iterator &it,
switch(p)
{
case pos::NEXT: it.Next(); break;
case pos::PREV: it.Prev(); break;
case pos::FRONT: it.SeekToFirst(); break;
case pos::BACK: it.SeekToLast(); break;
default:
case pos::NEXT:
assert(valid(it));
it.Next();
break;
case pos::PREV:
assert(valid(it));
it.Prev();
break;
case pos::FRONT:
it.SeekToFirst();
break;
case pos::BACK:
it.SeekToLast();
break;
case pos::END:
{
it.SeekToLast();
@ -5192,6 +5205,10 @@ ircd::db::_seek_(rocksdb::Iterator &it,
break;
}
default:
assert(false);
break;
}
return it;