CmdJoin: Fix segment fault on join.

Code was attempting to dereference the end () iterator, which is invalid.

Since sets are already ordered, we can use the first and last element directly
instead of using the min/max functions.

Fixes a bug introduced in ( 8ce9e83ab5 "TI-93 #97 Make CLI::getIds() return a
set to guarantee uniqueness of ids" )
This commit is contained in:
Shaun Ruffell 2019-01-04 10:58:41 -06:00 committed by lauft
parent 3780966ccd
commit 7c5503f962

View file

@ -62,8 +62,8 @@ int CmdJoin (
database.startTransaction ();
auto first_id = std::min (*ids.begin (), *ids.end ());
auto second_id = std::max (*ids.begin (), *ids.end ());
auto first_id = *ids.begin ();
auto second_id = *ids.rbegin ();
Interval first = tracked[tracked.size () - first_id];
Interval second = tracked[tracked.size () - second_id];