Android- Fix crash when querying for surface when window info was not created yet
authorTzach Shabtay <tzachshabtay@gmail.com>
Sun, 11 Dec 2016 22:47:26 +0000 (17:47 -0500)
committerTzach Shabtay <tzachshabtay@gmail.com>
Sun, 11 Dec 2016 22:47:26 +0000 (17:47 -0500)
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

index f4fd54dc6d5de9795ae3fecd3629e4640156427c..c4edb69d42e4eac5bc3b99a04f0e33a3bd7b0aa0 100644 (file)
@@ -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 {