From 4ee0b28ffca829f9a8392a658db586f72abbc4b2 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 7 Sep 2021 13:38:56 -0400 Subject: [PATCH] Coverity issue fixes. Fix Coverity issues 338623, 338716, and 338717. --- eeschema/tools/sch_editor_control.cpp | 3 --- pcbnew/pcb_painter.cpp | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 95477247ff..8f35345fb4 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -479,9 +479,6 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent ) break; } - - if( item ) - break; } } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 33a6dc7ca4..8b363e090f 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -785,7 +785,7 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer ) wxString netname = UnescapeString( aVia->GetShortNetname() ); // 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 ); // Use a smaller text size to handle interline, pen size.. @@ -977,7 +977,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer ) netname = "*"; // 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 ); // Use a smaller text size to handle interline, pen size...