Guard against div-0 in gauge

This commit is contained in:
Seth Hillbrand 2025-08-24 08:03:31 -07:00
parent 9dc76f658d
commit c842f2700f

View File

@ -190,10 +190,13 @@ void DIALOG_DRC::OnActivateDlg( wxActivateEvent& aEvent )
bool DIALOG_DRC::updateUI()
{
if( m_maxProgress != 0 )
{
double cur = std::clamp( (double) m_progress.load() / m_maxProgress, 0.0, 1.0 );
int newValue = KiROUND( cur * 1000.0 );
m_gauge->SetValue( newValue );
}
// There is significant overhead on at least Windows when updateUi is called constantly thousands of times
// in the drc process and safeyieldfor is called each time.