Pcbnew: loading file with footprint on an inner layer causes an assertion. (fixes lp:1556424)

This commit is contained in:
jean-pierre charras 2016-03-14 09:20:51 -04:00 committed by Wayne Stambaugh
parent 286f6a426b
commit 6657981553
2 changed files with 13 additions and 7 deletions

View File

@ -1,10 +1,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -899,6 +899,10 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
switch( m_Layer )
{
default:
wxASSERT_MSG( false, "Illegal layer" ); // do you really have modules placed on other layers?
// pass through
case F_Cu:
aLayers[1] = ITEM_GAL_LAYER( MOD_FR_VISIBLE );
break;
@ -906,10 +910,6 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
case B_Cu:
aLayers[1] = ITEM_GAL_LAYER( MOD_BK_VISIBLE );
break;
default:
assert( false ); // do you really have modules placed on inner layers?
break;
}
}

View File

@ -1692,7 +1692,13 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR
break;
case T_layer:
module->SetLayer( parseBoardItemLayer() );
{
// Footprints can be only on the front side or the back side.
// but because we can find some stupid layer in file, ensure a
// acceptable layer is set for the footprint
LAYER_ID layer = parseBoardItemLayer();
module->SetLayer( layer == B_Cu ? B_Cu : F_Cu );
}
NeedRIGHT();
break;