summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2014-07-16 10:39:21 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-12-03 00:22:49 -0800
commit1935f4c5db2ec505a7780958b2f76366fde851c5 (patch)
treee6aa8f76c43e8fc209b407e9877e254f29112873 /src/com/android
parent9897fb2d0072f942520b312514c85de7d43d8dd2 (diff)
downloadandroid_packages_apps_Gallery2-1935f4c5db2ec505a7780958b2f76366fde851c5.tar.gz
android_packages_apps_Gallery2-1935f4c5db2ec505a7780958b2f76366fde851c5.tar.bz2
android_packages_apps_Gallery2-1935f4c5db2ec505a7780958b2f76366fde851c5.zip
Gallery2: Fix monkey test fail
When click undo in filtershowActivity,the position can't be -1 In FilterShowActivity,the preset and Rect shouldn't be null. Add some check for position and null pointer check for preset and rect CRs-fixed: 693810 Change-Id: I70fa2ff86d40ad483474b60ab9071ccb151bd445
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/MasterImage.java3
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java8
-rw-r--r--src/com/android/gallery3d/filtershow/ui/ExportDialog.java7
3 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
index f6b97f11f..4b43d7672 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
@@ -271,6 +271,9 @@ public class MasterImage implements RenderingRequestCaller {
public void onHistoryItemClick(int position) {
HistoryItem historyItem = mHistory.getItem(position);
// We need a copy from the history
+ if (historyItem == null) {
+ return;
+ }
ImagePreset newPreset = new ImagePreset(historyItem.getImagePreset());
// don't need to add it to the history
setPreset(newPreset, historyItem.getFilterRepresentation(), false);
diff --git a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
index 4765a5990..e2945e9b9 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
@@ -67,9 +67,11 @@ public class ImagePreset {
}
public ImagePreset(ImagePreset source) {
- for (int i = 0; i < source.mFilters.size(); i++) {
- FilterRepresentation sourceRepresentation = source.mFilters.elementAt(i);
- mFilters.add(sourceRepresentation.copy());
+ if (source != null && source.mFilters != null) {
+ for (int i = 0; i < source.mFilters.size(); i++) {
+ FilterRepresentation sourceRepresentation = source.mFilters.elementAt(i);
+ mFilters.add(sourceRepresentation.copy());
+ }
}
}
diff --git a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java
index b42c9f367..7fdd36d0f 100644
--- a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java
+++ b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java
@@ -109,6 +109,13 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener
ImagePreset preset = MasterImage.getImage().getPreset();
mOriginalBounds = preset.finalGeometryRect(mOriginalBounds.width(),
mOriginalBounds.height());
+ if (preset != null) {
+ mOriginalBounds = preset.finalGeometryRect(mOriginalBounds.width(),
+ mOriginalBounds.height());
+ }
+ if (mOriginalBounds == null) {
+ return null;
+ }
mRatio = mOriginalBounds.width() / (float) mOriginalBounds.height();
mWidthText.setText("" + mOriginalBounds.width());
mHeightText.setText("" + mOriginalBounds.height());