Browse Source

Fix Popup.Close raising Closed events even when it is already closed.

Dariusz Komosinski 5 years ago
parent
commit
91c112b62c
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/Avalonia.Controls/Primitives/Popup.cs

+ 5 - 0
src/Avalonia.Controls/Primitives/Popup.cs

@@ -277,6 +277,11 @@ namespace Avalonia.Controls.Primitives
         /// </summary>
         public void Close()
         {
+            if (_topLevel is null)
+            {
+                return;
+            }
+
             if (_popupHost != null)
             {
                 _popupHost.TemplateApplied -= RootTemplateApplied;