Fix new bus parsers to correctly handle non-buses.
Fixes https://gitlab.com/kicad/code/kicad/issues/4403
This commit is contained in:
parent
74ee143d45
commit
105f85e551
|
@ -247,13 +247,14 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
|
|||
bool self_set = false;
|
||||
std::vector<wxString> bus_contents_vec;
|
||||
|
||||
if( alias )
|
||||
{
|
||||
for( const wxString& member : alias->Members() )
|
||||
bus_contents_vec.emplace_back( member );
|
||||
}
|
||||
else if( SCH_CONNECTION::ParseBusGroup( m_Label, &group_name, &bus_contents_vec ) )
|
||||
if( alias || SCH_CONNECTION::ParseBusGroup( m_Label, &group_name, &bus_contents_vec ) )
|
||||
{
|
||||
if( alias )
|
||||
{
|
||||
for( const wxString& member : alias->Members() )
|
||||
bus_contents_vec.emplace_back( member );
|
||||
}
|
||||
|
||||
// For named bus groups, like "USB{DP DM}"
|
||||
wxString group_prefix = ( group_name != "" ) ? ( group_name + "." ) : "";
|
||||
|
||||
|
|
|
@ -429,6 +429,8 @@ bool SCH_CONNECTION::ParseBusVector( const wxString& aBus, wxString* aName,
|
|||
long end = 0;
|
||||
int braceNesting = 0;
|
||||
|
||||
prefix.reserve( busLen );
|
||||
|
||||
// Parse prefix
|
||||
//
|
||||
for( ; i < busLen; ++i )
|
||||
|
@ -458,6 +460,9 @@ bool SCH_CONNECTION::ParseBusVector( const wxString& aBus, wxString* aName,
|
|||
//
|
||||
i++; // '[' character
|
||||
|
||||
if( i >= busLen )
|
||||
return false;
|
||||
|
||||
for( ; i < busLen; ++i )
|
||||
{
|
||||
if( aBus[i] == '.' && i + 1 < busLen && aBus[i+1] == '.' )
|
||||
|
@ -477,6 +482,9 @@ bool SCH_CONNECTION::ParseBusVector( const wxString& aBus, wxString* aName,
|
|||
//
|
||||
tmp = wxEmptyString;
|
||||
|
||||
if( i >= busLen )
|
||||
return false;
|
||||
|
||||
for( ; i < busLen; ++i )
|
||||
{
|
||||
if( aBus[i] == ']' )
|
||||
|
@ -543,6 +551,8 @@ bool SCH_CONNECTION::ParseBusGroup( wxString aGroup, wxString* aName,
|
|||
wxString tmp;
|
||||
int braceNesting = 0;
|
||||
|
||||
prefix.reserve( groupLen );
|
||||
|
||||
// Parse prefix
|
||||
//
|
||||
for( ; i < groupLen; ++i )
|
||||
|
@ -575,6 +585,9 @@ bool SCH_CONNECTION::ParseBusGroup( wxString aGroup, wxString* aName,
|
|||
//
|
||||
i++; // '{' character
|
||||
|
||||
if( i >= groupLen )
|
||||
return false;
|
||||
|
||||
for( ; i < groupLen; ++i )
|
||||
{
|
||||
if( aGroup[i] == '{' )
|
||||
|
|
Loading…
Reference in New Issue