Prevent crash if board doesn't have any layers in the layer preset.

This commit is contained in:
Jeff Young 2020-08-20 00:15:03 +01:00
parent 21a9f2ecfe
commit 6450ee2f2c
3 changed files with 5 additions and 20 deletions

View File

@ -28,30 +28,23 @@
#include <kicad_string.h>
#include <gestfich.h>
#include <pcb_edit_frame.h>
#include <macros.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <richio.h>
#include <pgm_base.h>
#include <msgpanel.h>
#include <fp_lib_table.h>
#include <kiface_i.h>
#include <kiway.h>
#include <kiway_player.h>
#include <trace_helpers.h>
#include <lockfile.cpp>
#include <netlist_reader/pcb_netlist.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <io_mgr.h>
#include <wildcards_and_files_ext.h>
#include <tool/tool_manager.h>
#include <drc/drc.h>
#include <class_board.h>
#include <wx/stdpaths.h>
#include <pcb_layer_widget.h>
#include <ratsnest/ratsnest_data.h>
#include <kiplatform/app.h>
#include <widgets/appearance_controls.h>
#include <wx/wupdlock.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
@ -313,6 +306,8 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
// Don't set name until the user hits save, so project files are not created
mgr->LoadProject( "" );
m_appearancePanel->OnBoardChanged();
LoadProjectSettings();
if( !Clear_Pcb( false ) )
@ -650,6 +645,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
GetBoard()->BuildConnectivity();
Compile_Ratsnest( true );
m_appearancePanel->OnBoardChanged();
// Load project settings after setting up board; some of them depend on the nets list
LoadProjectSettings();

View File

@ -996,7 +996,6 @@ void PCB_EDIT_FRAME::onBoardLoaded()
}
ReCreateLayerBox();
m_appearancePanel->OnBoardChanged();
// Sync layer and item visibility
GetCanvas()->SyncLayersVisibility( m_Pcb );

View File

@ -25,13 +25,7 @@
*/
#include <fctsys.h>
#include <kiface_i.h>
#include <confirm.h>
#include <gestfich.h>
#include <macros.h>
#include <pcb_edit_frame.h>
#include <board_design_settings.h>
#include <plotter.h>
#include <panel_hotkeys_editor.h>
#include <panel_edit_options.h>
#include <panel_pcbnew_color_settings.h>
@ -39,15 +33,10 @@
#include <panel_pcbnew_action_plugins.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <fp_lib_table.h>
#include <ws_data_model.h>
#include <class_board.h>
#include <class_module.h>
#include <pcbplot.h>
#include <pcb_painter.h>
#include <footprint_viewer_frame.h>
#include <invoke_pcb_dialog.h>
#include <wildcards_and_files_ext.h>
#include <widgets/appearance_controls.h>
#include <widgets/paged_dialog.h>
#include <widgets/panel_selection_filter.h>