mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-03-30 06:26:55 +00:00
Remove a few more crashers
Need to check SYM_LIB_TABLE_ENTRY for null but need to check FP_LIB_TABLE_ENTRY for throwing
This commit is contained in:
parent
9beca90185
commit
112e8e7ccb
eeschema/widgets
pcbnew
@ -99,7 +99,9 @@ PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER( SCH_BASE_FRAME* aFrame, wxWindow* aP
|
||||
bool pinned = alg::contains( session.pinned_symbol_libs, nickname )
|
||||
|| alg::contains( project.m_PinnedSymbolLibs, nickname );
|
||||
|
||||
if( libs->FindRow( nickname )->GetIsVisible() )
|
||||
SYMBOL_LIB_TABLE_ROW* row = libs->FindRow( nickname );
|
||||
|
||||
if( row && row->GetIsVisible() )
|
||||
adapter->AddLibrary( nickname, pinned );
|
||||
}
|
||||
}
|
||||
|
@ -527,10 +527,19 @@ bool FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool
|
||||
|
||||
wxString nickname = aFPID.GetLibNickname();
|
||||
wxString fpname = aFPID.GetLibItemName();
|
||||
wxString libfullname;
|
||||
|
||||
// Legacy libraries are readable, but modifying legacy format is not allowed
|
||||
// So prompt the user if he try to delete a footprint from a legacy lib
|
||||
wxString libfullname = PROJECT_PCB::PcbFootprintLibs( &Prj() )->FindRow( nickname )->GetFullURI();
|
||||
try
|
||||
{
|
||||
libfullname = PROJECT_PCB::PcbFootprintLibs( &Prj() )->FindRow( nickname )->GetFullURI();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// If we can't find the nickname, stop here
|
||||
return false;
|
||||
}
|
||||
|
||||
if( PCB_IO_MGR::GuessPluginTypeFromLibPath( libfullname ) == PCB_IO_MGR::LEGACY )
|
||||
{
|
||||
|
@ -79,16 +79,26 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::Sync( FP_LIB_TABLE* aLibs )
|
||||
{
|
||||
const wxString& name = it->get()->m_Name;
|
||||
|
||||
// Remove the library if it no longer exists or it exists in both the global and the
|
||||
// project library but the project library entry is disabled.
|
||||
if( !m_libs->HasLibrary( name, true )
|
||||
|| m_libs->FindRow( name, true ) != m_libs->FindRow( name, false ) )
|
||||
try
|
||||
{
|
||||
// Remove the library if it no longer exists or it exists in both the global and the
|
||||
// project library but the project library entry is disabled.
|
||||
if( !m_libs->HasLibrary( name, true )
|
||||
|| m_libs->FindRow( name, true ) != m_libs->FindRow( name, false ) )
|
||||
{
|
||||
it = deleteLibrary( it );
|
||||
continue;
|
||||
}
|
||||
|
||||
updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// If the library isn't found, remove it
|
||||
it = deleteLibrary( it );
|
||||
continue;
|
||||
}
|
||||
|
||||
updateLibrary( *(LIB_TREE_NODE_LIBRARY*) it->get() );
|
||||
++it;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user