diff options
| author | huiyan <huiyan@codeaurora.org> | 2016-04-22 16:02:31 +0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-05-03 20:13:52 -0700 |
| commit | 9d5d085de23c9c69b6101a7f9069147e94861779 (patch) | |
| tree | 04e2c0be668437afaa26561fd438cc9f1709d65f /src | |
| parent | b04211110dce21e7c898352313f0416f6e2ac9d9 (diff) | |
| download | android_packages_apps_Gallery2-9d5d085de23c9c69b6101a7f9069147e94861779.tar.gz android_packages_apps_Gallery2-9d5d085de23c9c69b6101a7f9069147e94861779.tar.bz2 android_packages_apps_Gallery2-9d5d085de23c9c69b6101a7f9069147e94861779.zip | |
Gallery2: Fix force closed when input long size at Export Flattened Image.
If input long size, the NumberFormatException occur
when parse int from string.
Try to catch the NumberFormatException,
and use the original width and height for user.
Change-Id: I5401f400c2ddb79aa9bd952a02de1c45222f5ae0
CRs-Fixed: 1002767
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/filtershow/ui/ExportDialog.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java index 1b8d1b044..1b8625946 100644 --- a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java +++ b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java @@ -216,7 +216,11 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener if (mWidthText.getText() != null) { String value = String.valueOf(mWidthText.getText()); if (value.length() > 0) { - width = Integer.parseInt(value); + try { + width = Integer.parseInt(value); + } catch (NumberFormatException e) { + width = Integer.MAX_VALUE; + } if (width > mOriginalBounds.width()) { width = mOriginalBounds.width(); mWidthText.setText("" + width); @@ -233,7 +237,11 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener if (mHeightText.getText() != null) { String value = String.valueOf(mHeightText.getText()); if (value.length() > 0) { - height = Integer.parseInt(value); + try { + height = Integer.parseInt(value); + } catch (NumberFormatException e) { + height = Integer.MAX_VALUE; + } if (height > mOriginalBounds.height()) { height = mOriginalBounds.height(); mHeightText.setText("" + height); |
