From 5b529647c9843007637b41addb3b454b77ab32a5 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Tue, 20 May 2014 01:00:54 +0200 Subject: [PATCH] [Mac] Fixed NRE and initial position on 64bit --- Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs b/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs index 358d25a3..001634f0 100644 --- a/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs +++ b/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs @@ -206,7 +206,6 @@ namespace OpenTK.Platform.MacOS // Set up behavior Cocoa.SendIntPtr(windowPtr, Selector.Get("setDelegate:"), windowPtr); // The window class acts as its own delegate - Cocoa.SendVoid(windowPtr, Selector.Get("cascadeTopLeftFromPoint:"), System.Drawing.PointF.Empty); Cocoa.SendVoid(windowPtr, Selector.Get("makeKeyWindow")); SetTitle(title, false); @@ -247,7 +246,12 @@ namespace OpenTK.Platform.MacOS { ResetTrackingArea(); } - GraphicsContext.CurrentContext.Update(windowInfo); + + var context = GraphicsContext.CurrentContext; + if (context != null) + { + context.Update(windowInfo); + } if (suppressResize == 0) OnResize(EventArgs.Empty);