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

Unified Diff: third_party/WebKit/Source/modules/peerconnection/RTCDataChannel.cpp

Issue 2888043003: Prevent access to null handler in RTCDataChannel. (Closed)
Patch Set: Add unit tests Created 3 years, 7 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 | third_party/WebKit/Source/modules/peerconnection/RTCDataChannelTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/peerconnection/RTCDataChannel.cpp
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCDataChannel.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCDataChannel.cpp
index 29bf7918ae5ab5ca4357eca0d421c5900520494e..ddfa8df5f19214e856a3ba6cca40bdc185ed6dd7 100644
--- a/third_party/WebKit/Source/modules/peerconnection/RTCDataChannel.cpp
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCDataChannel.cpp
@@ -25,6 +25,7 @@
#include "modules/peerconnection/RTCDataChannel.h"
#include <memory>
+#include <utility>
#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMArrayBufferView.h"
@@ -244,7 +245,8 @@ void RTCDataChannel::send(Blob* data, ExceptionState& exception_state) {
}
void RTCDataChannel::close() {
- handler_->Close();
+ if (handler_)
+ handler_->Close();
}
void RTCDataChannel::DidChangeReadyState(
@@ -319,6 +321,7 @@ void RTCDataChannel::ContextDestroyed(ExecutionContext*) {
stopped_ = true;
handler_->SetClient(nullptr);
handler_.reset();
+ ready_state_ = kReadyStateClosed;
}
// ActiveScriptWrappable
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/peerconnection/RTCDataChannelTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698