From 081ec393da9377cff4962f4bf7ea5e7da88ae0c4 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 28 Feb 2020 11:08:48 -0800 Subject: [PATCH] eeschema: Load using root sheet if null The root sheet is not set for pasting, in which case, we should utilize the global root if needed. Fixes #3956 | https://gitlab.com/kicad/code/kicad/issues/3956 --- eeschema/sch_legacy_plugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index 9b9cebd38c..6d680df29d 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -754,6 +754,11 @@ void SCH_LEGACY_PLUGIN::LoadContent( LINE_READER& aReader, SCH_SCREEN* aScreen, { m_version = version; + // We cannot safely load content without a set root level. If we haven't been given one, + // pick the default + if( m_rootSheet == nullptr ) + m_rootSheet = g_RootSheet; + while( aReader.ReadLine() ) { char* line = aReader.Line();