Skip to content
Browse files

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 ( 8ce9e83 "TI-93 #97 Make CLI::getIds() return a
set to guarantee uniqueness of ids" )
  • Loading branch information...
sruffell authored and lauft committed Jan 4, 2019
1 parent 3780966 commit 7c5503f962d223275f26303fbcb8d6188a05dd0a
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/commands/CmdJoin.cpp
@@ -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];

0 comments on commit 7c5503f

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.