Don't use wxApp-dependent functions in headless
When running headless, e.g. from Python script, the wxApp has not be instantiated, so we cannot use wxConfig. In this case, we fall back to the class defaults in ADVANCED_CONFIG()
This commit is contained in:
parent
4f05262705
commit
4486cdb92e
|
@ -26,6 +26,7 @@
|
|||
#include <config_params.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/log.h>
|
||||
|
@ -279,6 +280,10 @@ void ADVANCED_CFG::loadFromConfigFile()
|
|||
{
|
||||
const wxFileName k_advanced = getAdvancedCfgFilename();
|
||||
|
||||
// If we are running headless, use the class defaults because we cannot instantiate wxConfig
|
||||
if( !wxTheApp )
|
||||
return;
|
||||
|
||||
if( !k_advanced.FileExists() )
|
||||
{
|
||||
wxLogTrace( AdvancedConfigMask, "File does not exist %s", k_advanced.GetFullPath() );
|
||||
|
|
Loading…
Reference in New Issue