pcbnew: Fix VRML export checking
In rare cases, the VRML triangulator may claim to work but return empty
vectors. These cases need to be caught before we dereference the vector
elements.
Fixes: lp:1838448
* https://bugs.launchpad.net/kicad/+bug/1838448
(cherry picked from commit 161dc9ce7e
)
This commit is contained in:
parent
d4e9ddc14c
commit
ff28501d6d
|
@ -1690,7 +1690,8 @@ static void create_vrml_plane( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color
|
||||||
std::vector< int > idxPlane;
|
std::vector< int > idxPlane;
|
||||||
std::vector< int > idxSide;
|
std::vector< int > idxSide;
|
||||||
|
|
||||||
if( !(*layer).Get2DTriangles( vertices, idxPlane, top_z, aTopPlane ) )
|
if( !( *layer ).Get2DTriangles( vertices, idxPlane, top_z, aTopPlane ) || idxPlane.empty()
|
||||||
|
|| idxSide.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
|
@ -1776,7 +1777,8 @@ static void create_vrml_shell( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color
|
||||||
bottom_z = tmp;
|
bottom_z = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !(*layer).Get3DTriangles( vertices, idxPlane, idxSide, top_z, bottom_z ) )
|
if( !( *layer ).Get3DTriangles( vertices, idxPlane, idxSide, top_z, bottom_z )
|
||||||
|
|| idxPlane.empty() || idxSide.empty() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Reference in New Issue