1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

fix a couple more possible panics

This commit is contained in:
Ubuntu 2022-08-31 18:50:59 +00:00
parent efb1f3f2d5
commit cbc0a13d9b
3 changed files with 8 additions and 9 deletions

View file

@ -254,18 +254,18 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
if !has_serverbound_packets {
serverbound_id_match_contents.extend(quote! {
_ => panic!("This enum is empty and can't exist.")
_ => unreachable!("This enum is empty and can't exist.")
});
serverbound_write_match_contents.extend(quote! {
_ => panic!("This enum is empty and can't exist.")
_ => unreachable!("This enum is empty and can't exist.")
});
}
if !has_clientbound_packets {
clientbound_id_match_contents.extend(quote! {
_ => panic!("This enum is empty and can't exist.")
_ => unreachable!("This enum is empty and can't exist.")
});
clientbound_write_match_contents.extend(quote! {
_ => panic!("This enum is empty and can't exist.")
_ => unreachable!("This enum is empty and can't exist.")
});
}

View file

@ -209,7 +209,9 @@ impl McBufReadable for Recipe {
} else if recipe_type == ResourceLocation::new("minecraft:smithing").unwrap() {
RecipeData::Smithing(SmithingRecipe::read_from(buf)?)
} else {
panic!("Unknown recipe type sent by server: {}", recipe_type);
return Err(BufReadError::UnexpectedStringEnumVariant {
id: recipe_type.to_string(),
});
};
let recipe = Recipe { identifier, data };

View file

@ -172,10 +172,7 @@ where
azalea_crypto::decrypt_packet(cipher, buf.filled_mut());
}
}
match r {
Ok(()) => Poll::Ready(Ok(())),
Err(e) => panic!("{:?}", e),
}
Poll::Ready(r)
}
Poll::Pending => Poll::Pending,
}