mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-28 05:12:34 +00:00
fix potential unwrap on none
This commit is contained in:
@@ -83,7 +83,7 @@ impl StringUtils {
|
||||
"UTF8"
|
||||
} else if c.name() == encoding::all::ISO_8859_1.name() {
|
||||
"ISO8859_1"
|
||||
}else {
|
||||
} else {
|
||||
c.name()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ impl EANManufacturerOrgSupport {
|
||||
return Some(
|
||||
self.countryIdentifiers
|
||||
.get(i)
|
||||
.expect("must have index i or fail")
|
||||
// .clone(),
|
||||
.expect("must have index i or fail"), // .clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ use std::collections::HashMap;
|
||||
use crate::{
|
||||
common::BitArray,
|
||||
oned::{one_d_reader, OneDReader},
|
||||
BarcodeFormat, DecodeHintType, DecodingHintDictionary, Exceptions, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Reader, DecodeHintValue, RXingResultPoint,
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions,
|
||||
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint, Reader,
|
||||
};
|
||||
|
||||
use super::{
|
||||
@@ -263,14 +263,16 @@ impl RSS14Reader {
|
||||
let startEnd = self.findFinderPattern(row, right)?;
|
||||
let pattern = self.parseFoundFinderPattern(row, rowNumber, right, &startEnd)?;
|
||||
|
||||
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = hints.get(&DecodeHintType::NEED_RESULT_POINT_CALLBACK) {
|
||||
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) =
|
||||
hints.get(&DecodeHintType::NEED_RESULT_POINT_CALLBACK)
|
||||
{
|
||||
let startEnd = pattern.getStartEnd();
|
||||
let mut center :f32 = (startEnd[0] + startEnd[1] - 1) as f32 / 2.0;
|
||||
let mut center: f32 = (startEnd[0] + startEnd[1] - 1) as f32 / 2.0;
|
||||
if right {
|
||||
// row is actually reversed
|
||||
center = row.getSize() as f32 - 1.0 - center;
|
||||
}
|
||||
cb( &RXingResultPoint::new(center, rowNumber as f32));
|
||||
cb(&RXingResultPoint::new(center, rowNumber as f32));
|
||||
}
|
||||
|
||||
let outside = self.decodeDataCharacter(row, &pattern, true)?;
|
||||
|
||||
@@ -309,6 +309,10 @@ fn getBarcodeMetadata<T: DetectionRXingResultRowIndicatorColumn>(
|
||||
// return leftBarcodeMetadata;
|
||||
// }
|
||||
|
||||
if leftBarcodeMetadata.is_none() {
|
||||
return None;
|
||||
}
|
||||
|
||||
if leftBarcodeMetadata.as_ref().unwrap().getColumnCount()
|
||||
!= rightBarcodeMetadata.as_ref().unwrap().getColumnCount()
|
||||
&& leftBarcodeMetadata
|
||||
|
||||
Reference in New Issue
Block a user