Skip to content

Commit

Permalink
attempt to solve div/0 coverity defect with asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 20, 2020
1 parent f3e0bfa commit a29f1e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Etterna/Globals/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <unordered_set>
#include <deque>
#include <utility>
#include <assert.h>

using std::deque;
using std::max;
Expand Down Expand Up @@ -229,7 +230,7 @@ chord_proportion(const vector<NoteInfo>& NoteInfo, const int chord_size)
if (notes == chord_size)
chords += notes;
}

assert(taps > 0);
return static_cast<float>(chords) / static_cast<float>(taps);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/NoteData/NoteData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ NoteData::WifeTotalScoreCalc(TimingData* td, int iStartIndex, int iEndIndex)
}
}
}

ASSERT(taps > 0);
return taps * 2;
}

Expand Down

0 comments on commit a29f1e6

Please sign in to comment.