mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-04 08:15:39 +00:00
Avoid panic when streaming packets are empty (#1861)
* changed [] access to .get() to return result instead of panic * changed error type to protocol err * fixed issue with comparing ref * cargo fmt Co-authored-by: Erik Rhodes <erik@space-nav.com>
This commit is contained in:
parent
63291d677f
commit
c744cb7f60
@ -148,7 +148,11 @@ impl MySqlStream {
|
|||||||
// TODO: packet compression
|
// TODO: packet compression
|
||||||
// TODO: packet joining
|
// TODO: packet joining
|
||||||
|
|
||||||
if payload[0] == 0xff {
|
if payload
|
||||||
|
.get(0)
|
||||||
|
.ok_or(err_protocol!("Packet empty"))?
|
||||||
|
.eq(&0xff)
|
||||||
|
{
|
||||||
self.waiting.pop_front();
|
self.waiting.pop_front();
|
||||||
|
|
||||||
// instead of letting this packet be looked at everywhere, we check here
|
// instead of letting this packet be looked at everywhere, we check here
|
||||||
|
Loading…
x
Reference in New Issue
Block a user