This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 68d1eef689f Minor: avoid (likely unreachable) panic in FlightClient
(#5734)
68d1eef689f is described below
commit 68d1eef689f2b71304003ae7f1f813f3ebb20b5a
Author: Andrew Lamb <[email protected]>
AuthorDate: Wed May 8 01:53:31 2024 -0400
Minor: avoid (likely unreachable) panic in FlightClient (#5734)
---
arrow-flight/src/client.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arrow-flight/src/client.rs b/arrow-flight/src/client.rs
index f5f28f683a9..3f62b256d56 100644
--- a/arrow-flight/src/client.rs
+++ b/arrow-flight/src/client.rs
@@ -710,10 +710,14 @@ impl<T, E> Stream for FallibleRequestStream<T, E> {
match ready!(request_streams.poll_next_unpin(cx)) {
Some(Ok(data)) => Poll::Ready(Some(data)),
Some(Err(e)) => {
- // unwrap() here is safe, ownership of sender will
- // be moved only once as this stream will not be polled
- // again
- let _ = pinned.sender.take().unwrap().send(e);
+ // in theory this should only ever be called once
+ // as this stream should not be polled again after returning
+ // None, however we still check for None to be safe
+ if let Some(sender) = pinned.sender.take() {
+ // an error means the other end of the channel is not
around
+ // to receive the error, so ignore it
+ let _ = sender.send(e);
+ }
Poll::Ready(None)
}
None => Poll::Ready(None),