From 7a8bfc60eeeccb0d0232271d86e702c2c17ef5a7 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 15 Aug 2009 16:46:33 +0000 Subject: [PATCH] Modified CreateX11WindowInfo to check GraphicsMode.Index.HasValue prior to using it. --- Source/OpenTK/Platform/Utilities.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/OpenTK/Platform/Utilities.cs b/Source/OpenTK/Platform/Utilities.cs index 036d9a41..7efdaf1a 100644 --- a/Source/OpenTK/Platform/Utilities.cs +++ b/Source/OpenTK/Platform/Utilities.cs @@ -322,7 +322,11 @@ namespace OpenTK.Platform // get the X11 Visual info for the display. Platform.X11.XVisualInfo info = new Platform.X11.XVisualInfo(); - info.VisualID = mode.Index; + + if (!mode.Index.HasValue) + throw new GraphicsModeException("Invalid or unsupported GraphicsMode."); + + info.VisualID = mode.Index.Value; int dummy; window.VisualInfo = (Platform.X11.XVisualInfo)Marshal.PtrToStructure( Platform.X11.Functions.XGetVisualInfo(window.Display, Platform.X11.XVisualInfoMask.ID,