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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/lib/DispatcherBase_cpp.template

Issue 2327273002: [DevTools] Added more null check into DispatcherBase template (Closed)
Patch Set: Created 4 years, 3 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: third_party/WebKit/Source/platform/inspector_protocol/lib/DispatcherBase_cpp.template
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/lib/DispatcherBase_cpp.template b/third_party/WebKit/Source/platform/inspector_protocol/lib/DispatcherBase_cpp.template
index 4fdfbd55350b939f810725d275f235893d5ef2b4..76f77aae7ece7871d2db5e64aa626ea8f308a208 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/lib/DispatcherBase_cpp.template
+++ b/third_party/WebKit/Source/platform/inspector_protocol/lib/DispatcherBase_cpp.template
@@ -90,6 +90,8 @@ void DispatcherBase::sendResponse(int callId, const ErrorString& invocationError
static void reportProtocolErrorTo(FrontendChannel* frontendChannel, int callId, DispatcherBase::CommonErrorCode code, const String& errorMessage, ErrorSupport* errors)
{
+ if (!frontendChannel)
+ return;
std::unique_ptr<protocol::DictionaryValue> error = DictionaryValue::create();
error->setInteger("code", code);
error->setString("message", errorMessage);
@@ -104,8 +106,7 @@ static void reportProtocolErrorTo(FrontendChannel* frontendChannel, int callId,
void DispatcherBase::reportProtocolError(int callId, CommonErrorCode code, const String& errorMessage, ErrorSupport* errors)
{
- if (m_frontendChannel)
- reportProtocolErrorTo(m_frontendChannel, callId, code, errorMessage, errors);
+ reportProtocolErrorTo(m_frontendChannel, callId, code, errorMessage, errors);
}
void DispatcherBase::clearFrontend()
@@ -141,7 +142,7 @@ void UberDispatcher::dispatch(std::unique_ptr<Value> parsedMessage)
int callId = 0;
protocol::Value* callIdValue = messageObject->get("id");
- bool success = callIdValue->asInteger(&callId);
+ bool success = callIdValue && callIdValue->asInteger(&callId);
if (!success)
return;
« 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