Skip to content

Commit

Permalink
prevent circularshifting an empty vector
Browse files Browse the repository at this point in the history
this crashes
for example, this is attempted if you have a musicwheel size of 0 (which is possible)
  • Loading branch information
poco0317 committed Sep 16, 2020
1 parent b7c49cd commit 2eb4c98
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/RageUtil/Utils/RageUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ void
CircularShift(std::vector<T>& v, int dist)
{
for (int i = std::abs(dist); i > 0; i--) {
if (v.size() == 0)
break;
if (dist > 0) {
T t = v[0];
v.erase(v.begin());
Expand Down

0 comments on commit 2eb4c98

Please sign in to comment.