7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-09 00:05:19 +00:00

Kimath: don't access aActual unless set

Avoids at least one test failure in qa_pcbnew
due to uninitialised access.
This commit is contained in:
John Beard 2025-01-24 16:43:36 +08:00
parent d9a243d98c
commit 43be371f83

View File

@ -471,7 +471,7 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_SEGMENT& aB, int a
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );
if( aActual )
if( rv && aActual )
*aActual = std::max( 0, *aActual - aB.GetWidth() / 2 );
return rv;
@ -487,7 +487,7 @@ static inline bool Collide( const SHAPE_SEGMENT& aA, const SHAPE_SEGMENT& aB, in
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );
if( aActual )
if( rv && aActual )
*aActual = std::max( 0, *aActual - aB.GetWidth() / 2 );
return rv;
@ -503,7 +503,7 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_SEGMENT
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );
if( aActual )
if( rv && aActual )
*aActual = std::max( 0, *aActual - aB.GetWidth() / 2 );
return rv;