From 302038fbfd6b1af34f19b5ad9839ebb43f3c87a0 Mon Sep 17 00:00:00 2001
From: Wayne Stambaugh <stambaughw@gmail.com>
Date: Fri, 9 Feb 2024 13:16:07 -0500
Subject: [PATCH] Do not assume schematic child objects have a valid parent.

---
 eeschema/sch_edit_frame.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index 5ccc96d1a2..bd8e606981 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -1781,8 +1781,12 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
             {
             case SCH_FIELD_T:
             case SCH_PIN_T:
-                static_cast<SCH_ITEM*>( item->GetParent() )->SetConnectivityDirty();
+            {
+                SCH_ITEM* parent = static_cast<SCH_ITEM*>( item->GetParent() );
+                wxCHECK2( parent, continue );
+                parent->SetConnectivityDirty();
                 break;
+            }
 
             default:
                 item->SetConnectivityDirty();