Skip to content

called Result::unwrap() on an Err for detect_multiple_in_luma_with_hints #86

@forzafedor

Description

@forzafedor

Hi!

In my project, I get image dimensions from data parsing using the "image" library and then pass them to this function. If the data is invalid, the function returns 0.

When using the "detect_multiple_in_luma_with_hints" function, if one of the image dimensions is 0, we get "Result::unwrap() on an Err".

Do you think this is correct behavior?

Test:

#[test]
fn test_zero_size_image() {
    use rxing::DecodeHints;

    let mut hints: DecodeHints =
        DecodeHints::default().with(rxing::DecodeHintValue::TryHarder(true));

    let data = Vec::new();
    rxing::helpers::detect_multiple_in_luma_with_hints(data, 0, 0, &mut hints).unwrap_or_default();
}

Outut:

thread 'test_zero_size_image' (18007) panicked at src/binary_bitmap.rs:147:87:
called `Result::unwrap()` on an `Err` value: IllegalArgumentException("Both dimensions must be greater than 0")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions