From: Bergmann89 <bergmann89@muo-game.de>
Date: Sun, 16 Nov 2014 19:39:03 +0000 (+0100)
Subject: * [Context] check Visual before using it
X-Git-Url: https://git.delphigl.com/?a=commitdiff_plain;h=371dc0877dd9333c727389e0e5feda8a0125934d;p=LazOpenGLCore.git

* [Context] check Visual before using it
---

diff --git a/uglcContextGtk2GLX.pas b/uglcContextGtk2GLX.pas
index b3ddb20..f9d1475 100644
--- a/uglcContextGtk2GLX.pas
+++ b/uglcContextGtk2GLX.pas
@@ -351,6 +351,9 @@ var
   attrList: TGLIntArray;
   drawable: PGdkDrawable;
 begin
+  if not Assigned(aControl) then
+    raise EArgumentException.Create('aControl is not assigned');
+
   {
     Temporary (realized) widget to get to display
   }
@@ -382,6 +385,8 @@ begin
       FVisual  := glXChooseVisual(FDisplay, DefaultScreen(FDisplay), @attrList[0]);
     end;
   end;
+  if not Assigned(FVisual) then
+    raise EGLXError.Create('choose visual failed');
 
   {
     Most widgets inherit the drawable of their parent. In contrast to Windows, descending from