mirror of https://github.com/grpc/grpc-java.git
okhttp: Fix AsyncSink.close() NPE
This fixes a regression introduced in e96d0477. The NullPointerException
only happens on client-side when some other error occurred during
handshaking.
I tried to add a test, but SerializingExecutor catches+logs the
exception and the expected behavior in the circumstance is that close()
is a noop. So the NPE was entirely benign other than annoying log
messages.
This commit is contained in:
parent
3de7e74c57
commit
e767905f4a
|
|
@ -208,7 +208,7 @@ final class AsyncSink implements Sink {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (buffer.size() > 0) {
|
if (sink != null && buffer.size() > 0) {
|
||||||
sink.write(buffer, buffer.size());
|
sink.write(buffer, buffer.size());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue