mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Guard against div-0 in gauge
This commit is contained in:
parent
9dc76f658d
commit
c842f2700f
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user