Minor fixes. - Prevent a crash if m_activeTools is empty (should not happen, but you know the Murphy's law) - Better use of conditions in FOOTPRINT_EDIT_FRAME::Process_Special_Functions()

This commit is contained in:
Maciej Suminski 2015-08-07 18:17:51 +02:00
parent a4ffb065d4
commit 03d8d6850a
2 changed files with 5 additions and 6 deletions

View File

@ -639,7 +639,7 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
{
// Reset VIEW_CONTROLS only if the most recent tool is finished
if( m_activeTools.front() == aState->theTool->GetId() )
if( m_activeTools.empty() || m_activeTools.front() == aState->theTool->GetId() )
m_viewControls->Reset();
if( !aState->Pop() ) // if there are no other contexts saved on the stack

View File

@ -547,13 +547,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
LoadModuleFromLibrary( GetCurrentLib(), Prj().PcbFootprintLibs(), true );
if( GetBoard()->m_Modules )
if( GetBoard() && GetBoard()->m_Modules )
{
GetBoard()->m_Modules->ClearFlags();
// if either m_Reference or m_Value are gone, reinstall them -
// otherwise you cannot see what you are doing on board
if( GetBoard() && GetBoard()->m_Modules )
{
TEXTE_MODULE* ref = &GetBoard()->m_Modules->Reference();
TEXTE_MODULE* val = &GetBoard()->m_Modules->Value();