From 6c73fe05e97753f9bfd04ef502e895066c2d4eea Mon Sep 17 00:00:00 2001
From: jean-pierre charras <jp.charras@wanadoo.fr>
Date: Sun, 18 Dec 2022 18:18:53 +0100
Subject: [PATCH] python scripting: better fix for commit 5a79821 (fix crash
 due to a null pointer): Try to use a better error message for severity. Fixes
 #13160 https://gitlab.com/kicad/code/kicad/issues/13160

---
 pcbnew/python/scripting/pcbnew_scripting_helpers.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp
index 6ef468779a..10d9e2eb20 100644
--- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp
+++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp
@@ -534,7 +534,7 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
     for( const std::shared_ptr<DRC_ITEM>& item : violations )
     {
         SEVERITY severity = item->GetParent() ? item->GetParent()->GetSeverity()
-                                              : RPT_SEVERITY_UNDEFINED;
+                                              : bds.GetSeverity( item->GetErrorCode() );
         fprintf( fp, "%s", TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
     }