Add a few missing SSL_R_BIO_NOT_SET cases.

The ssl_buffer.cc code handles this, but since outgoing handshake I/O
goes through a different path, it was missing these checks.

Change-Id: I4fed62b435b577645c405d0d995511a58d47a702
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46531
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/d1_both.cc b/ssl/d1_both.cc
index c7f85c7..9829355 100644
--- a/ssl/d1_both.cc
+++ b/ssl/d1_both.cc
@@ -771,6 +771,11 @@
     return -1;
   }
 
+  if (ssl->wbio == nullptr) {
+    OPENSSL_PUT_ERROR(SSL, SSL_R_BIO_NOT_SET);
+    return -1;
+  }
+
   dtls1_update_mtu(ssl);
 
   int ret = -1;
diff --git a/ssl/s3_both.cc b/ssl/s3_both.cc
index 4415bd7..92d3a24 100644
--- a/ssl/s3_both.cc
+++ b/ssl/s3_both.cc
@@ -322,6 +322,11 @@
     }
   }
 
+  if (ssl->wbio == nullptr) {
+    OPENSSL_PUT_ERROR(SSL, SSL_R_BIO_NOT_SET);
+    return -1;
+  }
+
   // Write the pending flight.
   while (ssl->s3->pending_flight_offset < ssl->s3->pending_flight->length) {
     int ret = BIO_write(