GRAPHICS: Handle cases where glGetString returns a nullptr

This commit is contained in:
Le Philousophe 2023-03-11 17:08:01 +01:00
parent 528378a560
commit 6bbcd95c10

View File

@ -104,7 +104,10 @@ void Context::initialize(ContextType contextType) {
const char *verString = (const char *)glGetString(GL_VERSION);
if (type == kContextGL) {
if (!verString) {
majorVersion = minorVersion = 0;
warning("Could not parse fetch GL_VERSION: %d", glGetError());
} else if (type == kContextGL) {
// OpenGL version number is either of the form major.minor or major.minor.release,
// where the numbers all have one or more digits
if (sscanf(verString, "%d.%d", &majorVersion, &minorVersion) != 2) {
@ -141,6 +144,9 @@ void Context::initialize(ContextType contextType) {
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&maxTextureSize);
const char *extString = (const char *)glGetString(GL_EXTENSIONS);
if (!extString) {
extString = "";
}
bool ARBShaderObjects = false;
bool ARBShadingLanguage100 = false;