mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
fix potential unwrap on none
This commit is contained in:
@@ -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;
|
||||
// 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)?;
|
||||
|
||||
Reference in New Issue
Block a user