mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Avoid AIOOBE, again, with over large correction for nudge in corner cases
git-svn-id: https://zxing.googlecode.com/svn/trunk@2809 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
8968ca75ce
commit
c35e8e38ea
|
@ -149,10 +149,18 @@ public class QRCodeReader implements Reader {
|
|||
// But careful that this does not sample off the edge
|
||||
int nudgedTooFarRight = left + (int) ((matrixWidth - 1) * moduleSize) - (right - 1);
|
||||
if (nudgedTooFarRight > 0) {
|
||||
if (nudgedTooFarRight > nudge) {
|
||||
// Neither way fits; abort
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
left -= nudgedTooFarRight;
|
||||
}
|
||||
int nudgedTooFarDown = top + (int) ((matrixHeight - 1) * moduleSize) - (bottom - 1);
|
||||
if (nudgedTooFarDown > 0) {
|
||||
if (nudgedTooFarDown > nudge) {
|
||||
// Neither way fits; abort
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
top -= nudgedTooFarDown;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue