summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow
diff options
context:
space:
mode:
authorzhuw <zhuw@codeaurora.org>2017-08-04 18:12:02 +0800
committerzhuw <zhuw@codeaurora.org>2017-08-04 18:12:02 +0800
commit6a2f79c801af5bb336a3d92f79e5061bdff8705c (patch)
tree8d28796631b5f19aa043c1ec86dd4fdf11217e1b /src/com/android/gallery3d/filtershow
parentda299f0a074c62dd1ae105089cf7c64b1e5032a8 (diff)
downloadandroid_packages_apps_Gallery2-6a2f79c801af5bb336a3d92f79e5061bdff8705c.tar.gz
android_packages_apps_Gallery2-6a2f79c801af5bb336a3d92f79e5061bdff8705c.tar.bz2
android_packages_apps_Gallery2-6a2f79c801af5bb336a3d92f79e5061bdff8705c.zip
Fix monkey nullpointer crash when getEditor in panel
add nullpointer check for all editors got from FilterShowActivity Change-Id: I183fc5ace1536de0e3a897ab9a0e8e32d62c494e CRs-Fixed: 2087676
Diffstat (limited to 'src/com/android/gallery3d/filtershow')
-rw-r--r--src/com/android/gallery3d/filtershow/category/EditorCropPanel.java8
-rw-r--r--src/com/android/gallery3d/filtershow/category/TruePortraitMaskEditorPanel.java4
-rw-r--r--src/com/android/gallery3d/filtershow/category/TrueScannerPanel.java8
3 files changed, 15 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java b/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java
index db7dfd019..baaa3e128 100644
--- a/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java
@@ -105,7 +105,9 @@ public class EditorCropPanel extends BasicGeometryPanel {
mApplyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- mEditorCrop.finalApplyCalled();
+ if (mEditorCrop != null) {
+ mEditorCrop.finalApplyCalled();
+ }
activity.backToMain();
activity.setActionBar();
}
@@ -146,7 +148,9 @@ public class EditorCropPanel extends BasicGeometryPanel {
private void changeSelection(int index) {
if (index >= 0 && index < mButtons.length) {
mSelectPosition = index;
- mEditorCrop.changeCropAspect(mCropAspectIds[index]);
+ if (mEditorCrop != null) {
+ mEditorCrop.changeCropAspect(mCropAspectIds[index]);
+ }
highlightIndex(index);
}
}
diff --git a/src/com/android/gallery3d/filtershow/category/TruePortraitMaskEditorPanel.java b/src/com/android/gallery3d/filtershow/category/TruePortraitMaskEditorPanel.java
index 4390b90a7..b117e2103 100644
--- a/src/com/android/gallery3d/filtershow/category/TruePortraitMaskEditorPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/TruePortraitMaskEditorPanel.java
@@ -60,7 +60,9 @@ public class TruePortraitMaskEditorPanel extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mMainView = inflater.inflate(R.layout.filtershow_trueportrait_editor_panel, container, false);
- mEditor.setUpEditorUI(mMainView, null);
+ if (mEditor != null) {
+ mEditor.setUpEditorUI(mMainView, null);
+ }
return mMainView;
}
diff --git a/src/com/android/gallery3d/filtershow/category/TrueScannerPanel.java b/src/com/android/gallery3d/filtershow/category/TrueScannerPanel.java
index f5f57645c..611b9cf2a 100644
--- a/src/com/android/gallery3d/filtershow/category/TrueScannerPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/TrueScannerPanel.java
@@ -60,7 +60,9 @@ public class TrueScannerPanel extends BasicGeometryPanel {
if (mTrueScannerEditor == null) {
mTrueScannerEditor = (TrueScannerEditor) activity.getEditor(TrueScannerEditor.ID);
}
- mTrueScannerEditor.initCords();
+ if (mTrueScannerEditor != null) {
+ mTrueScannerEditor.initCords();
+ }
mExitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -72,7 +74,9 @@ public class TrueScannerPanel extends BasicGeometryPanel {
mApplyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- mTrueScannerEditor.finalApplyCalled();
+ if (mTrueScannerEditor != null) {
+ mTrueScannerEditor.finalApplyCalled();
+ }
activity.backToMain();
activity.setActionBar();
}