Skip to content

Commit

Permalink
check that codec is inferrable before trying
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotcubit committed Jul 30, 2021
1 parent 6f06c95 commit 0f50e83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fn decode(f: Format, value: Vec<u8>) -> (Format, Result<Vec<u8>, Error>) {
codecs_preferred_order()
.into_iter()
.find_map(|codec| {
if f == Format::Inferred {
if f == Format::Inferred && codec.inferrable() {
if let Ok(result) = codec.decode(value.clone()) {
return Some((codec.format(), Ok(result)));
} else {
Expand Down

0 comments on commit 0f50e83

Please sign in to comment.