Ensure GAL::SetGridSize( const VECTOR2D& aGridSize ) use non null sizes

aGridSize.x or aGridSize.y can be null if the config file has stored
0 as size.
This is illegal and crashed Kicad.
The min legal value is 1.0 in internal units
This commit is contained in:
jean-pierre charras 2020-07-07 20:44:46 +02:00
parent 77313e4398
commit fbc3ba8c04
1 changed files with 4 additions and 0 deletions

View File

@ -881,6 +881,10 @@ public:
{
gridSize = aGridSize;
// Avoid stupid grid size values: a grid size should be >= 1 in internal units
gridSize.x = std::max( 1.0, gridSize.x );
gridSize.y = std::max( 1.0, gridSize.y );
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
(long) gridOrigin.y % (long) gridSize.y );
}