Divide-by-zero safety.
This commit is contained in:
parent
a8028e3bd1
commit
8502fd6877
|
@ -404,7 +404,8 @@ void SCH_EAGLE_PLUGIN::checkpoint()
|
|||
{
|
||||
if( ++m_doneCount > m_lastProgressCount + PROGRESS_DELTA )
|
||||
{
|
||||
m_progressReporter->SetCurrentProgress(( (double) m_doneCount ) / m_totalCount );
|
||||
m_progressReporter->SetCurrentProgress( ( (double) m_doneCount )
|
||||
/ std::max( 1U, m_totalCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
|
|
|
@ -86,7 +86,8 @@ void SCH_SEXPR_PARSER::checkpoint()
|
|||
|
||||
if( curLine > m_lastProgressLine + PROGRESS_DELTA )
|
||||
{
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine ) / m_lineCount );
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine )
|
||||
/ std::max( 1U, m_lineCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
|
|
|
@ -619,7 +619,8 @@ void SCH_LEGACY_PLUGIN::checkpoint()
|
|||
|
||||
if( curLine > m_lastProgressLine + PROGRESS_DELTA )
|
||||
{
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine ) / m_lineCount );
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine )
|
||||
/ std::max( 1U, m_lineCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
|
|
|
@ -321,7 +321,8 @@ void EAGLE_PLUGIN::checkpoint()
|
|||
{
|
||||
if( ++m_doneCount > m_lastProgressCount + PROGRESS_DELTA )
|
||||
{
|
||||
m_progressReporter->SetCurrentProgress(( (double) m_doneCount ) / m_totalCount );
|
||||
m_progressReporter->SetCurrentProgress( ( (double) m_doneCount )
|
||||
/ std::max( 1U, m_totalCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
|
|
|
@ -66,7 +66,8 @@ void FABMASTER::checkpoint()
|
|||
{
|
||||
if( ++m_doneCount > m_lastProgressCount + PROGRESS_DELTA )
|
||||
{
|
||||
m_progressReporter->SetCurrentProgress(( (double) m_doneCount ) / m_totalCount );
|
||||
m_progressReporter->SetCurrentProgress( ( (double) m_doneCount )
|
||||
/ std::max( 1U, m_totalCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
|
|
|
@ -115,7 +115,8 @@ void PCB_PARSER::checkpoint()
|
|||
|
||||
if( curLine > m_lastProgressLine + PROGRESS_DELTA )
|
||||
{
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine ) / m_lineCount );
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine )
|
||||
/ std::max( 1U, m_lineCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
|
|
|
@ -206,7 +206,8 @@ void LEGACY_PLUGIN::checkpoint()
|
|||
|
||||
if( curLine > m_lastProgressLine + PROGRESS_DELTA )
|
||||
{
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine ) / m_lineCount );
|
||||
m_progressReporter->SetCurrentProgress( ( (double) curLine )
|
||||
/ std::max( 1U, m_lineCount ) );
|
||||
|
||||
if( !m_progressReporter->KeepRefreshing() )
|
||||
THROW_IO_ERROR( ( "Open cancelled by user." ) );
|
||||
|
|
Loading…
Reference in New Issue