Skip to content

Commit df3511e

Browse files
arttu-peltonenEvergreen
authored andcommitted
Fix SampleDependencyImporter errors when opening/closing the window rapidly
1 parent cdb87a8 commit df3511e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ VisualElement panelRoot
4848
{
4949
get
5050
{
51-
_panelRoot ??= injectingElement.panel.visualTree;
51+
_panelRoot ??= injectingElement?.panel?.visualTree;
5252
return _panelRoot;
5353
}
5454
}
@@ -82,11 +82,11 @@ VisualElement IPackageManagerExtension.CreateExtensionUI()
8282

8383
void RefreshSampleButtons()
8484
{
85-
if (injectingElement == null || m_PackageInfo == null || m_SampleList == null)
85+
if (injectingElement == null || m_PackageInfo == null || m_SampleList == null || panelRoot == null)
8686
return;
8787

8888
// Call refresh of samples and button injection when switching to the "Samples" tab.
89-
if (samplesButton == null )
89+
if (samplesButton == null)
9090
{
9191
samplesButton = panelRoot.Q<Button>(name: samplesButtonName);
9292
if (samplesButton != null)

0 commit comments

Comments
 (0)