mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Fixed bug 3720 - SDL_GL_GetAttribute doesn't check for initialized video driver
Simon Hug SDL_GL_GetAttribute doesn't check if a video driver has been initialized and will access the SDL_VideoDevice pointer, which is NULL at that point. I think all of the attributes require an initialized driver, so a simple NULL check should fix it. Patch is attached.
This commit is contained in:
parent
ee3f11d545
commit
e10a98d2ad
@ -1111,11 +1111,16 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set an OpenGL window attribute before window creation.
|
* \brief Set an OpenGL window attribute before window creation.
|
||||||
|
*
|
||||||
|
* \return 0 on success, or -1 if the attribute could not be set.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
|
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the actual value for an attribute from the current context.
|
* \brief Get the actual value for an attribute from the current context.
|
||||||
|
*
|
||||||
|
* \return 0 on success, or -1 if the attribute could not be retrieved.
|
||||||
|
* The integer at \c value will be modified in either case.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
|
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
|
||||||
|
|
||||||
|
@ -3113,9 +3113,17 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
|||||||
GLenum attachmentattrib = 0;
|
GLenum attachmentattrib = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
return SDL_InvalidParamError("value");
|
||||||
|
}
|
||||||
|
|
||||||
/* Clear value in any case */
|
/* Clear value in any case */
|
||||||
*value = 0;
|
*value = 0;
|
||||||
|
|
||||||
|
if (!_this) {
|
||||||
|
return SDL_UninitializedVideo();
|
||||||
|
}
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case SDL_GL_RED_SIZE:
|
case SDL_GL_RED_SIZE:
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL
|
||||||
|
Loading…
Reference in New Issue
Block a user