Prevent divide-by-zero in DIALOG_PCM_PROGRESS

This commit is contained in:
Jon Evans 2021-11-25 16:23:16 -05:00
parent da458535c4
commit 250de83bf2
1 changed files with 5 additions and 3 deletions

View File

@ -110,9 +110,11 @@ void DIALOG_PCM_PROGRESS::SetFinished()
bool DIALOG_PCM_PROGRESS::updateUI()
{
bool finished = m_finished.load();
int phase = m_phase.load();
int phases = m_numPhases.load();
double current = m_currentProgress.load() / (double) m_currentProgressTotal.load();
int phase = m_phase.load();
int phases = m_numPhases.load();
long cp = m_currentProgress.load();
long total = m_currentProgressTotal.load();
double current = ( total > 0 ) ? ( double( cp ) / double( total ) ) : 0;
if( phases > 0 )
current = ( phase + current ) / phases;