mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 00:21:31 +00:00
OUTSET_ROUTINE::ProcessItem(): handle an exception thrown for incorrect prm.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19880
This commit is contained in:
parent
5fda0d02e1
commit
dc1ecea4bc
@ -25,10 +25,11 @@
|
||||
|
||||
#include "geometry/roundrect.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <ki_exception.h>
|
||||
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <geometry/shape_utils.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
|
||||
namespace
|
||||
@ -55,13 +56,13 @@ ROUNDRECT::ROUNDRECT( SHAPE_RECT aRect, int aRadius ) :
|
||||
{
|
||||
if( m_radius > m_rect.MajorDimension() )
|
||||
{
|
||||
throw std::invalid_argument(
|
||||
"Roundrect radius is larger than the rectangle's major dimension" );
|
||||
throw KI_PARAM_ERROR(
|
||||
_( "Roundrect radius is larger than the rectangle's major dimension" ) );
|
||||
}
|
||||
|
||||
if( m_radius < 0 )
|
||||
{
|
||||
throw std::invalid_argument( "Roundrect radius must be non-negative" );
|
||||
throw KI_PARAM_ERROR( _( "Roundrect radius must be non-negative" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <pad.h>
|
||||
#include <pcb_track.h>
|
||||
#include <tools/pcb_tool_utils.h>
|
||||
#include <confirm.h>
|
||||
#include <ki_exception.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -908,10 +910,18 @@ void OUTSET_ROUTINE::ProcessItem( BOARD_ITEM& aItem )
|
||||
SHAPE_RECT rect( box );
|
||||
if( m_params.roundCorners )
|
||||
{
|
||||
ROUNDRECT rrect( rect, m_params.outsetDistance );
|
||||
SHAPE_POLY_SET poly;
|
||||
rrect.TransformToPolygon( poly, 0, ERROR_LOC::ERROR_OUTSIDE );
|
||||
addPoly( poly );
|
||||
try
|
||||
{
|
||||
ROUNDRECT rrect( rect, m_params.outsetDistance );
|
||||
SHAPE_POLY_SET poly;
|
||||
rrect.TransformToPolygon( poly, 0, ERROR_LOC::ERROR_OUTSIDE );
|
||||
addPoly( poly );
|
||||
}
|
||||
catch( const KI_PARAM_ERROR& error )
|
||||
{
|
||||
DisplayErrorMessage( nullptr, error.What() );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user