diff options
author | Masaaki Iwaguchi <masaaki.x.iwaguchi@sonymobile.com> | 2015-04-03 16:11:39 +0900 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-07-08 12:02:34 -0700 |
commit | d145bd5d3b6c69c3e1d6e6ad0c259c28972a5cb9 (patch) | |
tree | dac6ed94bb4f8780ddaac12af5b891a9c018127b /packages/PrintSpooler | |
parent | b6bddad1b6a0dc4f26651a1c44d8bfb57bd33fb2 (diff) | |
download | frameworks_base-d145bd5d3b6c69c3e1d6e6ad0c259c28972a5cb9.zip frameworks_base-d145bd5d3b6c69c3e1d6e6ad0c259c28972a5cb9.tar.gz frameworks_base-d145bd5d3b6c69c3e1d6e6ad0c259c28972a5cb9.tar.bz2 |
Avoid NPE in printspooler when changing language
PrintActivity is recreated when the language setting is changed.
As a result of the recreation mCurrentPrinter is null, which causes
a NullPointerException when onActivityResult() is called.
The issue is solved with a simple null check.
Change-Id: Ic58f0ca01577d2ec02d494739f3bc2f06240dd44
Diffstat (limited to 'packages/PrintSpooler')
-rw-r--r-- | packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index 1fb84b4..8f680d7 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -671,9 +671,11 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat } } - PrinterId printerId = mCurrentPrinter.getId(); - final int index = mDestinationSpinnerAdapter.getPrinterIndex(printerId); - mDestinationSpinner.setSelection(index); + if (mCurrentPrinter != null) { + PrinterId printerId = mCurrentPrinter.getId(); + final int index = mDestinationSpinnerAdapter.getPrinterIndex(printerId); + mDestinationSpinner.setSelection(index); + } } private void startAdvancedPrintOptionsActivity(PrinterInfo printer) { |