Browse Source

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
pull/16/head
jean-pierre charras 5 years ago
parent
commit
fbc3ba8c04
  1. 4
      include/gal/graphics_abstraction_layer.h

4
include/gal/graphics_abstraction_layer.h

@ -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 );
}

Loading…
Cancel
Save