Fix GLHelperReadbackSupport::SupportsFormat crash
GetString(GL_EXTENSIONS) can return NULL if the context was lost. Handle gracefully. BUG=421608 Review URL: https://codereview.chromium.org/639073003 Cr-Commit-Position: refs/heads/master@{#298759}
This commit is contained in:
@@ -106,10 +106,12 @@ bool GLHelperReadbackSupport::SupportsFormat(GLenum format, GLenum type) {
|
||||
|
||||
if (format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE) {
|
||||
const GLubyte* tmp = gl_->GetString(GL_EXTENSIONS);
|
||||
std::string extensions =
|
||||
" " + std::string(reinterpret_cast<const char*>(tmp)) + " ";
|
||||
if (extensions.find(" GL_EXT_read_format_bgra ") != std::string::npos) {
|
||||
return true;
|
||||
if (tmp) {
|
||||
std::string extensions =
|
||||
" " + std::string(reinterpret_cast<const char*>(tmp)) + " ";
|
||||
if (extensions.find(" GL_EXT_read_format_bgra ") != std::string::npos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user