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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp

Issue 2158363004: [DevTools] Avoid dereferencing null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 5 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
6 6
7 #include "platform/inspector_protocol/Parser.h" 7 #include "platform/inspector_protocol/Parser.h"
8 #include "platform/v8_inspector/InjectedScript.h" 8 #include "platform/v8_inspector/InjectedScript.h"
9 #include "platform/v8_inspector/InspectedContext.h" 9 #include "platform/v8_inspector/InspectedContext.h"
10 #include "platform/v8_inspector/RemoteObjectId.h" 10 #include "platform/v8_inspector/RemoteObjectId.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr ing, int contextId) 134 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr ing, int contextId)
135 { 135 {
136 if (!contextId) { 136 if (!contextId) {
137 *errorString = "Cannot find context with specified id"; 137 *errorString = "Cannot find context with specified id";
138 return nullptr; 138 return nullptr;
139 } 139 }
140 140
141 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId); 141 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId);
142 auto contextsIt = contexts ? contexts->find(contextId) : contexts->end(); 142 if (!contexts) {
143 *errorString = "Cannot find context with specified id";
144 return nullptr;
145 }
146
147 auto contextsIt = contexts->find(contextId);
143 if (contextsIt == contexts->end()) { 148 if (contextsIt == contexts->end()) {
144 *errorString = "Cannot find context with specified id"; 149 *errorString = "Cannot find context with specified id";
145 return nullptr; 150 return nullptr;
146 } 151 }
147 152
148 const std::unique_ptr<InspectedContext>& context = contextsIt->second; 153 const std::unique_ptr<InspectedContext>& context = contextsIt->second;
149 if (!context->getInjectedScript()) { 154 if (!context->getInjectedScript()) {
150 context->createInjectedScript(); 155 context->createInjectedScript();
151 if (!context->getInjectedScript()) { 156 if (!context->getInjectedScript()) {
152 *errorString = "Cannot access specified execution context"; 157 *errorString = "Cannot access specified execution context";
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 m_debuggerAgent->resume(&errorString); 300 m_debuggerAgent->resume(&errorString);
296 } 301 }
297 302
298 void V8InspectorSessionImpl::stepOver() 303 void V8InspectorSessionImpl::stepOver()
299 { 304 {
300 ErrorString errorString; 305 ErrorString errorString;
301 m_debuggerAgent->stepOver(&errorString); 306 m_debuggerAgent->stepOver(&errorString);
302 } 307 }
303 308
304 } // namespace blink 309 } // namespace blink
OLDNEW
« 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