← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] pcbnew crashes when loading file with bad net ID

 

Expecting() raises an exception.  I would rather use THROW_IO_ERROR() to
tell the user not only where the offending net code is in the file but
also that it is an offending net code that is the issue.  Expecting()
should be used when there is an invalid token or expected value type.
In this case the value can be parsed it just results in an invalid board.

On 6/7/2015 7:24 PM, Chris Pavlina wrote:
> If you try to load a kicad_pcb into pcbnew that refers to an invalid net 
> ID, pcbnew crashes after failing an assertion. It should display an 
> error indicating that the file is corrupt instead. I've changed 
> BOARD_CONNECTED_ITEM::SetNetCode() to be able to indicate whether the 
> code was valid, rather than just asserting, and then changed 
> PCB_PARSER::parseTRACK() to check for this and complain using 
> Expecting().
> 
> I'd rather have used an exception to do this, but we don't have any 
> exception types that look suitable. Thoughts?
> 
> Here's a board file that causes this: 
> http://misc.c4757p.com/2VB701E.kicad_pcb
> 
> --
> Chris
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



References