diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index fce580c95e..08069fedb0 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -457,7 +457,16 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits, wxFileName fn = aBoard->GetFileName(); fn.SetExt( DesignRulesFileExtension ); - wxString drcRulesPath = s_SettingsManager->Prj().AbsolutePath( fn.GetFullName() ); + PROJECT* prj = nullptr; + + if( aBoard->GetProject() ) + prj = aBoard->GetProject(); + else if( s_SettingsManager ) + prj = &s_SettingsManager->Prj(); + + wxCHECK( prj, false ); + + wxString drcRulesPath = prj->AbsolutePath( fn.GetFullName() ); try {