Add some safety checks to Excellon number format detection
Fixes: lp:1754121 * https://bugs.launchpad.net/kicad/+bug/1754121
This commit is contained in:
parent
4152069504
commit
a931ac436a
|
@ -559,6 +559,13 @@ bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
|
|||
|
||||
while( IsNumber( *read ) )
|
||||
{
|
||||
if( *read == '.' )
|
||||
{
|
||||
integer = nbdigits;
|
||||
read++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( ( *read >= '0' ) && ( *read <='9' ) )
|
||||
nbdigits++;
|
||||
|
||||
|
@ -567,6 +574,10 @@ bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
|
|||
|
||||
mantissa = nbdigits - integer;
|
||||
|
||||
// Enforce minimum mantissa of 3 for metric
|
||||
if( m_GerbMetric && mantissa < 3 )
|
||||
mantissa = 3;
|
||||
|
||||
m_FmtScale.x = m_FmtScale.y = mantissa;
|
||||
m_FmtLen.x = m_FmtLen.y = integer + mantissa;
|
||||
|
||||
|
|
Loading…
Reference in New Issue