mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Avoid weird NPE observed in 4.3.2
git-svn-id: https://zxing.googlecode.com/svn/trunk@2792 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
78b8a696bd
commit
556013145b
|
@ -82,7 +82,8 @@ public final class ViewfinderView extends View {
|
|||
return; // not ready yet, early draw before done configuring
|
||||
}
|
||||
Rect frame = cameraManager.getFramingRect();
|
||||
if (frame == null) {
|
||||
Rect previewFrame = cameraManager.getFramingRectInPreview();
|
||||
if (frame == null || previewFrame == null) {
|
||||
return;
|
||||
}
|
||||
int width = canvas.getWidth();
|
||||
|
@ -108,7 +109,6 @@ public final class ViewfinderView extends View {
|
|||
int middle = frame.height() / 2 + frame.top;
|
||||
canvas.drawRect(frame.left + 2, middle - 1, frame.right - 1, middle + 2, paint);
|
||||
|
||||
Rect previewFrame = cameraManager.getFramingRectInPreview();
|
||||
float scaleX = frame.width() / (float) previewFrame.width();
|
||||
float scaleY = frame.height() / (float) previewFrame.height();
|
||||
|
||||
|
|
Loading…
Reference in a new issue