Navigation Menu

Skip to content

Commit

Permalink
Fix #5093: When no GL context was present, OpenGLModule::assertNoErro…
Browse files Browse the repository at this point in the history
…rs() ran into an endless loop until your memory ran out
  • Loading branch information
codereader committed Jan 2, 2020
1 parent 252b453 commit 3c40334
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions radiant/render/OpenGLModule.cpp
Expand Up @@ -34,6 +34,7 @@ void OpenGLModule::assertNoErrors()

// Build list of all GL errors
std::string allErrString = "GL errors encountered: ";
int maxErrors = 100;

for ( ; error != GL_NO_ERROR; error = glGetError())
{
Expand All @@ -42,6 +43,12 @@ void OpenGLModule::assertNoErrors()
);
allErrString += string::to_string(error);
allErrString += " (" + std::string(strErr) + ") ";

if (--maxErrors <= 0)
{
allErrString += "---> Maximum number of GL errors reached, maybe there is a problem with the GL context?";
break;
}
}

// Show the error message and terminate
Expand Down

0 comments on commit 3c40334

Please sign in to comment.