Fixed bounds checking. Not the root cause but keeps things from crashing.
This commit is contained in:
parent
d248736f08
commit
4486b0b6d6
|
@ -458,7 +458,8 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow*
|
||||||
|
|
||||||
panel->GetGAL()->SetGridVisibility( gridCfg.show );
|
panel->GetGAL()->SetGridVisibility( gridCfg.show );
|
||||||
|
|
||||||
int gridIdx = std::max( 0, std::min( gridCfg.last_size_idx, (int) gridCfg.sizes.size() ) );
|
//Bounds checking cannot include number of elements as an index!
|
||||||
|
int gridIdx = std::max( 0, std::min( gridCfg.last_size_idx, (int) gridCfg.sizes.size() - 1 ) );
|
||||||
int gridSize = (int) ValueFromString( EDA_UNITS::INCHES, gridCfg.sizes[ gridIdx ], true );
|
int gridSize = (int) ValueFromString( EDA_UNITS::INCHES, gridCfg.sizes[ gridIdx ], true );
|
||||||
panel->GetGAL()->SetGridSize( VECTOR2D( gridSize, gridSize ) );
|
panel->GetGAL()->SetGridSize( VECTOR2D( gridSize, gridSize ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue