mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Don't blindly deref an optional
Since the optional might not have a value (and the wxVariant seems to equate 0 with an empty string), we should check for the valid optional first and fallback to 0 if not set Fixes https://gitlab.com/kicad/code/kicad/-/issues/21081
This commit is contained in:
parent
10413f778c
commit
a5896e231a
@ -164,7 +164,19 @@ public:
|
||||
* @return the zone's clearance in internal units.
|
||||
*/
|
||||
std::optional<int> GetLocalClearance() const override;
|
||||
void SetLocalClearance( std::optional<int> aClearance ) { m_ZoneClearance = aClearance.value(); }
|
||||
|
||||
/**
|
||||
* Set the local clearance for this zone.
|
||||
*
|
||||
* @param aClearance is the clearance in internal units, or std::nullopt to clear it.
|
||||
*/
|
||||
void SetLocalClearance( std::optional<int> aClearance )
|
||||
{
|
||||
if( aClearance )
|
||||
m_ZoneClearance = aClearance.value();
|
||||
else
|
||||
m_ZoneClearance = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return any local clearances set in the "classic" (ie: pre-rule) system.
|
||||
|
Loading…
x
Reference in New Issue
Block a user