Skip to content

Commit

Permalink
Fix possible division by 0 defect
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Apr 2, 2018
1 parent ea648b9 commit 74516bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ScoreKeeperNormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void ScoreKeeperNormal::HandleTapNoteScoreInternal( const NoteData &nd, TapNoteS
{
if (separately)
{
m_pPlayerStageStats->m_iActualDancePoints += (TapNoteScoreToDancePoints(tns)*nd.GetNumTracksLCD()) / notes;
m_pPlayerStageStats->m_iActualDancePoints += notes != 0 ? (TapNoteScoreToDancePoints(tns)*nd.GetNumTracksLCD()) / notes : 0;
}
else
{
Expand All @@ -402,7 +402,7 @@ void ScoreKeeperNormal::HandleTapNoteScoreInternal( const NoteData &nd, TapNoteS
// increment the current total possible dance score
if (separately)
{
m_pPlayerStageStats->m_iCurPossibleDancePoints += (TapNoteScoreToDancePoints(maximum)*nd.GetNumTracksLCD()) / notes;
m_pPlayerStageStats->m_iCurPossibleDancePoints += notes != 0 ? (TapNoteScoreToDancePoints(maximum)*nd.GetNumTracksLCD()) / notes : 0;
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion src/XMLProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,8 @@ void XMLProfile::LoadStatsXmlForConversion() {
return;

XNode* scores = xml.GetChild("SongScores");
LoadSongScoresFromNode(scores);
if (scores != nullptr)
LoadSongScoresFromNode(scores);
}


Expand Down

0 comments on commit 74516bb

Please sign in to comment.