summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler/src
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2014-06-12 10:43:20 -0700
committerSvetoslav <svetoslavganov@google.com>2014-06-12 10:43:23 -0700
commite3bbb3d6c09a29cddeb544308e5b3210908fa256 (patch)
tree9ef6aff2f95669bd5172c1ad747f2f4630d7c9b1 /packages/PrintSpooler/src
parent4604abc97d7dd757bb76ff9b7fcf343dc4a15212 (diff)
downloadframeworks_base-e3bbb3d6c09a29cddeb544308e5b3210908fa256.zip
frameworks_base-e3bbb3d6c09a29cddeb544308e5b3210908fa256.tar.gz
frameworks_base-e3bbb3d6c09a29cddeb544308e5b3210908fa256.tar.bz2
Fix NPE in PrintActivity.
It is possible that the orientation is chosen before the media size. The code handling orientation change was wrognly expecting to have a selected media size all the time resulting in a NPE. bug:15512333 Change-Id: I9f2786af314641144a24c1d1363c8d2590b0df57
Diffstat (limited to 'packages/PrintSpooler/src')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index f71cafe..3e0d7e5 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -1735,10 +1735,12 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
} else if (spinner == mOrientationSpinner) {
SpinnerItem<Integer> orientationItem = mOrientationSpinnerAdapter.getItem(position);
PrintAttributes attributes = mPrintJob.getAttributes();
- if (orientationItem.value == ORIENTATION_PORTRAIT) {
- attributes.copyFrom(attributes.asPortrait());
- } else {
- attributes.copyFrom(attributes.asLandscape());
+ if (mMediaSizeSpinner.getSelectedItem() != null) {
+ if (orientationItem.value == ORIENTATION_PORTRAIT) {
+ attributes.copyFrom(attributes.asPortrait());
+ } else {
+ attributes.copyFrom(attributes.asLandscape());
+ }
}
}