summaryrefslogtreecommitdiffstats
path: root/net/websockets
diff options
context:
space:
mode:
Diffstat (limited to 'net/websockets')
-rw-r--r--net/websockets/websocket_channel.cc4
-rw-r--r--net/websockets/websocket_channel_test.cc2
2 files changed, 4 insertions, 2 deletions
diff --git a/net/websockets/websocket_channel.cc b/net/websockets/websocket_channel.cc
index 652142b..47114f8 100644
--- a/net/websockets/websocket_channel.cc
+++ b/net/websockets/websocket_channel.cc
@@ -421,7 +421,9 @@ void WebSocketChannel::SendFlowControl(int64 quota) {
const size_t bytes_to_send =
std::min(base::checked_cast<size_t>(quota), data_size);
const bool final = front.final() && data_size == bytes_to_send;
- const char* data = front.data()->data() + front.offset();
+ const char* data = front.data() ?
+ front.data()->data() + front.offset() : NULL;
+ DCHECK(!bytes_to_send || data) << "Non empty data should not be null.";
const std::vector<char> data_vector(data, data + bytes_to_send);
DVLOG(3) << "Sending frame previously split due to quota to the "
<< "renderer: quota=" << quota << " data_size=" << data_size
diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc
index 82078cb..464c30e 100644
--- a/net/websockets/websocket_channel_test.cc
+++ b/net/websockets/websocket_channel_test.cc
@@ -2406,7 +2406,7 @@ TEST_F(WebSocketChannelFlowControlTest, EmptyMessageNoQuota) {
{FINAL_FRAME, WebSocketFrameHeader::kOpCodeText,
NOT_MASKED, "FIRST MESSAGE"},
{FINAL_FRAME, WebSocketFrameHeader::kOpCodeText,
- NOT_MASKED, ""},
+ NOT_MASKED, NULL},
{FINAL_FRAME, WebSocketFrameHeader::kOpCodeText,
NOT_MASKED, "THIRD MESSAGE"}};
stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);