Coverity issue fixes.

Fix Coverity issues 338623, 338716, and 338717.
This commit is contained in:
Wayne Stambaugh 2021-09-07 13:38:56 -04:00
parent c816168e42
commit 4ee0b28ffc
2 changed files with 2 additions and 5 deletions

View File

@ -479,9 +479,6 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
break; break;
} }
if( item )
break;
} }
} }

View File

@ -785,7 +785,7 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer )
wxString netname = UnescapeString( aVia->GetShortNetname() ); wxString netname = UnescapeString( aVia->GetShortNetname() );
// approximate the size of net name text: // approximate the size of net name text:
double tsize = 1.5 * size / PrintableCharCount( netname ); double tsize = 1.5 * size / std::max( PrintableCharCount( netname ), 1 );
tsize = std::min( tsize, size ); tsize = std::min( tsize, size );
// Use a smaller text size to handle interline, pen size.. // Use a smaller text size to handle interline, pen size..
@ -977,7 +977,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
netname = "*"; netname = "*";
// approximate the size of net name text: // approximate the size of net name text:
double tsize = 1.5 * padsize.x / PrintableCharCount( netname ); double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( netname ), 1 );
tsize = std::min( tsize, size ); tsize = std::min( tsize, size );
// Use a smaller text size to handle interline, pen size... // Use a smaller text size to handle interline, pen size...