Skip to content

Commit

Permalink
Merge pull request #164 from tuttarealstep/master
Browse files Browse the repository at this point in the history
Prevent panic on client poll function
  • Loading branch information
Snowiiii authored Oct 21, 2024
2 parents bb05095 + c350348 commit 11a588b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pumpkin/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,17 @@ impl Client {
dec.reserve(4096);
let mut buf = dec.take_capacity();

if self
.connection_reader
.lock()
.await
.read_buf(&mut buf)
.await
.unwrap()
== 0
{
self.close();
return false;
match self.connection_reader.lock().await.read_buf(&mut buf).await {
Ok(0) => {
self.close();
return false;
}
Err(error) => {
log::error!("Error while reading incoming packet {}", error);
self.close();
return false;
}
_ => {}
}

// This should always be an O(1) unsplit because we reserved space earlier and
Expand Down

0 comments on commit 11a588b

Please sign in to comment.