Skip to content

Commit

Permalink
Merge 7268f39 into a8322be
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Oct 17, 2023
2 parents a8322be + 7268f39 commit 1170441
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/candid/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "candid"
version = "0.9.9"
version = "0.9.10"
edition = "2021"
authors = ["DFINITY Team"]
description = "Candid is an interface description language (IDL) for interacting with canisters running on the Internet Computer."
Expand Down
6 changes: 5 additions & 1 deletion rust/candid/src/de.rs
Expand Up @@ -423,7 +423,11 @@ impl<'de> Deserializer<'de> {
where
V: Visitor<'de>,
{
Err(Error::subtype("Cannot decode empty type"))
Err(if *self.wire_type == TypeInner::Empty {
Error::msg("Cannot decode empty type")
} else {
Error::subtype("Cannot decode empty type")
})
}
fn deserialize_future<'a, V>(&'a mut self, visitor: V) -> Result<V::Value>
where
Expand Down
3 changes: 1 addition & 2 deletions rust/candid/src/types/value.rs
Expand Up @@ -451,8 +451,7 @@ impl<'de> Visitor<'de> for IDLValueVisitor {
5u8 => {
use std::io::Read;
let len = leb128::read::unsigned(&mut bytes).map_err(E::custom)? as usize;
let mut buf = Vec::new();
buf.resize(len, 0);
let mut buf = vec![0; len];
bytes.read_exact(&mut buf).map_err(E::custom)?;
let meth = String::from_utf8(buf).map_err(E::custom)?;
let id = crate::Principal::try_from(bytes).map_err(E::custom)?;
Expand Down

0 comments on commit 1170441

Please sign in to comment.