diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index d3a2dbe1ba..789eb2c08f 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -190,7 +190,7 @@ REFDES_PREFIX_INFO* DIALOG_BOARD_REANNOTATE::GetOrBuildRefDesInfo( const wxStrin // Wasn't in the info array so add it REFDES_PREFIX_INFO newtype; newtype.RefDesPrefix = aRefDesPrefix; - newtype.LastUsedRefDes = aStartRefDes - 1; + newtype.LastUsedRefDes = std::max( aStartRefDes - 1, 0 ); m_refDesPrefixInfos.push_back( newtype ); return &m_refDesPrefixInfos.back();