Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc

Issue 2693553002: Only initialize a std::string with data when the data has len > 0. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
index db92cb4dda07bee3497fdbda38c24f1fed4cc801..d9f2abc71a7f61dd723ccb0cc258274a8d3ee9fe 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
@@ -1089,7 +1089,7 @@ error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog(
std::vector<char> buffer(info_log_len, 0);
glGetProgramInfoLog(GetProgramServiceID(program, resources_), info_log_len,
nullptr, buffer.data());
- *infolog = std::string(buffer.data());
+ *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string();
return error::kNoError;
}
@@ -1143,7 +1143,7 @@ error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog(
glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len);
std::vector<char> buffer(info_log_len, 0);
glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data());
- *infolog = std::string(buffer.data());
+ *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string();
return error::kNoError;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698