From ac95683211eceaec9f9c2a6611224f7f518b4fb5 Mon Sep 17 00:00:00 2001 From: kaiyiz Date: Mon, 14 Apr 2014 10:52:02 +0800 Subject: Gallery2: Fix Gallery2 ANR when run monkey When we create ExportDialog View,a null pointer is used to reset mOriginalBounds which cause this bug happened. Add a condition when judge conditon is null,then not to reset mOriginalBounds to avoid this bug. CRs-fixed: 647207 Change-Id: If91434c3ca15a287600097b7a5ec8c5aa7d7d6e2 --- src/com/android/gallery3d/filtershow/ui/ExportDialog.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java index b42c9f367..579067c64 100644 --- a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java +++ b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java @@ -107,8 +107,10 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener mOriginalBounds = MasterImage.getImage().getOriginalBounds(); ImagePreset preset = MasterImage.getImage().getPreset(); - mOriginalBounds = preset.finalGeometryRect(mOriginalBounds.width(), - mOriginalBounds.height()); + if (preset != null) { + mOriginalBounds = preset.finalGeometryRect(mOriginalBounds.width(), + mOriginalBounds.height()); + } mRatio = mOriginalBounds.width() / (float) mOriginalBounds.height(); mWidthText.setText("" + mOriginalBounds.width()); mHeightText.setText("" + mOriginalBounds.height()); -- cgit v1.2.3