Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit b4036e7

Browse files
authored
Add some nullptr checkers. (#20)
1 parent 22ac527 commit b4036e7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

quic_transport/impl/quic_transport_owt_client_impl.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ void QuicTransportOwtClientImpl::ConnectOnCurrentThread(
128128

129129
void QuicTransportOwtClientImpl::CloseOnCurrentThread(
130130
base::WaitableEvent* event) {
131+
if (client_ == nullptr) {
132+
return;
133+
}
134+
if (client_->session() == nullptr) {
135+
return;
136+
}
137+
if (client_->session()->connection() == nullptr) {
138+
return;
139+
}
140+
CHECK(client_);
141+
CHECK(client_->session());
142+
CHECK(client_->session()->connection());
143+
// Above code just makes code scan tools happy.
131144
if (client_ && client_->session() && client_->session()->connection()) {
132145
client_->session()->connection()->CloseConnection(
133146
::quic::QuicErrorCode::QUIC_NO_ERROR, "Close connection.",
@@ -177,6 +190,7 @@ QuicTransportStreamInterface* QuicTransportOwtClientImpl::CreateOutgoingStream(
177190
[](QuicTransportOwtClientImpl* client,
178191
QuicTransportStreamInterface** result,
179192
bool bidirectional, base::WaitableEvent* event) {
193+
CHECK(client);
180194
*result = client->CreateOutgoingStreamOnCurrentThread(
181195
bidirectional);
182196
event->Signal();

quic_transport/impl/quic_transport_owt_server_session.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ void QuicTransportOwtServerSession::OnIncomingDataStream(
123123
if (!session) {
124124
return;
125125
}
126+
CHECK(session);
126127
if (session->visitor_) {
127128
session->visitor_->OnIncomingStream(stream_ptr);
128129
}
@@ -141,6 +142,7 @@ void QuicTransportOwtServerSession::OnCanCreateNewOutgoingStream(
141142
if (!session) {
142143
return;
143144
}
145+
CHECK(session);
144146
if (session->visitor_) {
145147
session->visitor_->OnCanCreateNewOutgoingStream(unidirectional);
146148
}

0 commit comments

Comments
 (0)