NRE -> GraphicsContextMissingException

Throw a GraphicsContextMissingException if GraphicsBindingBase.LoadAll() is called without a current GraphicsContext.
This commit is contained in:
Stefanos A. 2013-10-03 16:45:28 +02:00
parent 0e221a0ce5
commit 94c02e827a

View file

@ -51,7 +51,10 @@ namespace OpenTK.Graphics
/// </remarks>
protected override IntPtr GetAddress(string funcname)
{
return (GraphicsContext.CurrentContext as IGraphicsContextInternal).GetAddress(funcname);
var context = GraphicsContext.CurrentContext as IGraphicsContextInternal;
if (context == null)
throw new GraphicsContextMissingException();
return context != null ? context.GetAddress(funcname) : IntPtr.Zero;
}
}
}