Browse Source

Merge pull request #5703 from AvaloniaUI/osx-fix-rare-segfault

OSX segfault - add null pointer check.
Jumar Macato 4 years ago
parent
commit
bb6431b7e4
1 changed files with 5 additions and 2 deletions
  1. 5 2
      native/Avalonia.Native/src/OSX/window.mm

+ 5 - 2
native/Avalonia.Native/src/OSX/window.mm

@@ -2231,9 +2231,12 @@ protected:
     {
         @autoreleasepool
         {
-            [Window setContentSize:NSSize{x, y}];
+            if (Window != nullptr)
+            {
+                [Window setContentSize:NSSize{x, y}];
             
-            [Window setFrameTopLeftPoint:ToNSPoint(ConvertPointY(lastPositionSet))];
+                [Window setFrameTopLeftPoint:ToNSPoint(ConvertPointY(lastPositionSet))];
+            }
             
             return S_OK;
         }