diff --git a/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs b/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs index d2a8bef4d18..c0af592b1ee 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs @@ -48,7 +48,7 @@ VisualElement panelRoot { get { - _panelRoot ??= injectingElement.panel.visualTree; + _panelRoot ??= injectingElement?.panel?.visualTree; return _panelRoot; } } @@ -82,11 +82,11 @@ VisualElement IPackageManagerExtension.CreateExtensionUI() void RefreshSampleButtons() { - if (injectingElement == null || m_PackageInfo == null || m_SampleList == null) + if (injectingElement == null || m_PackageInfo == null || m_SampleList == null || panelRoot == null) return; // Call refresh of samples and button injection when switching to the "Samples" tab. - if (samplesButton == null ) + if (samplesButton == null) { samplesButton = panelRoot.Q