From 877e197fec82be0333df66bd778709a3e3aa6879 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@craftyjon.com>
Date: Thu, 23 Jan 2025 18:25:07 -0500
Subject: [PATCH] Fix another footprint field fallout

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19729
---
 pcbnew/footprint.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp
index 1a09c3880d..b94bf34a77 100644
--- a/pcbnew/footprint.cpp
+++ b/pcbnew/footprint.cpp
@@ -663,7 +663,7 @@ void FOOTPRINT::RemoveField( const wxString& aFieldName )
 {
     for( unsigned i = 0; i < m_fields.size(); ++i )
     {
-        if( m_fields[i] && m_fields[ i ]->IsMandatory() )
+        if( !m_fields[i] || m_fields[ i ]->IsMandatory() )
             continue;
 
         if( aFieldName == m_fields[i]->GetName( false ) )