From 57ceff19b90b3326ed5a830f2f8f5e80037cf3d7 Mon Sep 17 00:00:00 2001 From: Tzach Shabtay Date: Sun, 11 Dec 2016 17:47:26 -0500 Subject: [PATCH 1/2] Android- Fix crash when querying for surface when window info was not created yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HasSurface is called by ReadyToRender property to query if the surface was created, but it’s possible that the window info was not created yet, added a missing null check. --- src/OpenTK/Platform/Android/AndroidGraphicsContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs b/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs index f4fd54dc..c4edb69d 100644 --- a/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs +++ b/src/OpenTK/Platform/Android/AndroidGraphicsContext.cs @@ -57,7 +57,7 @@ namespace OpenTK.Platform.Android { public bool HasSurface { - get { return eglWindowInfo.Surface != IntPtr.Zero; } + get { return eglWindowInfo != null && eglWindowInfo.Surface != IntPtr.Zero; } } public ISurfaceHolder Holder { From 0e20faf8966ac7b3a0297a42e3c64b55d6240e27 Mon Sep 17 00:00:00 2001 From: Tzach Shabtay Date: Sun, 11 Dec 2016 17:50:38 -0500 Subject: [PATCH 2/2] Android- fix a crash when the game view is closed before it started running MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the game view is closed, if it hasn’t started running yet the stopwatch would still be null- added a null check. --- src/OpenTK/Platform/Android/AndroidGameView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK/Platform/Android/AndroidGameView.cs b/src/OpenTK/Platform/Android/AndroidGameView.cs index cb438b67..6d6d01e0 100644 --- a/src/OpenTK/Platform/Android/AndroidGameView.cs +++ b/src/OpenTK/Platform/Android/AndroidGameView.cs @@ -457,7 +457,7 @@ namespace OpenTK.Platform.Android // if the render thread is paused, let it run so it exits pauseSignal.Set (); - stopWatch.Stop (); + if (stopWatch != null) stopWatch.Stop (); } void PauseThread ()