Browse Source

Avoid crash when glGetString(GL_EXTENSIONS) returns nullptr.

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
ba86c3d2f8
  1. 16
      src/Context.cpp

16
src/Context.cpp

@ -213,12 +213,16 @@ Context::Context() {
/* OpenGL 2.1 / OpenGL ES 2.0 doesn't have glGetStringi() */ /* OpenGL 2.1 / OpenGL ES 2.0 doesn't have glGetStringi() */
} else { } else {
vector<string> extensions = Corrade::Utility::split(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)), ' '); /* Don't crash when glGetString() returns nullptr */
for(const string& extension: extensions) { const char* e = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
auto found = futureExtensions.find(extension); if(e) {
if(found != futureExtensions.end()) { vector<string> extensions = Corrade::Utility::split(e, ' ');
_supportedExtensions.push_back(found->second); for(const string& extension: extensions) {
extensionStatus.set(found->second._index); auto found = futureExtensions.find(extension);
if(found != futureExtensions.end()) {
_supportedExtensions.push_back(found->second);
extensionStatus.set(found->second._index);
}
} }
} }
} }

Loading…
Cancel
Save