diff options
Diffstat (limited to 'azalea-protocol/src/write.rs')
| -rw-r--r-- | azalea-protocol/src/write.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs index 3d8540eb..bf9fd0aa 100644 --- a/azalea-protocol/src/write.rs +++ b/azalea-protocol/src/write.rs @@ -10,7 +10,9 @@ pub async fn write_packet(packet: impl ProtocolPacket, stream: &mut TcpStream) { // write the packet id let mut id_and_data_buf = vec![]; - id_and_data_buf.write_varint(packet.id() as i32); + id_and_data_buf + .write_varint(packet.id() as i32) + .expect("Writing packet id failed"); packet.write(&mut id_and_data_buf); // write the packet data @@ -18,7 +20,9 @@ pub async fn write_packet(packet: impl ProtocolPacket, stream: &mut TcpStream) { // make a new buffer that has the length at the beginning // and id+data at the end let mut complete_buf: Vec<u8> = Vec::new(); - complete_buf.write_varint(id_and_data_buf.len() as i32); + complete_buf + .write_varint(id_and_data_buf.len() as i32) + .expect("Writing packet length failed"); complete_buf.append(&mut id_and_data_buf); // finally, write and flush to the stream |
