summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java
index 7c2e55f35cde..cf73aacb9b55 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java
@@ -285,6 +285,11 @@ public final class SelectPrinterActivity extends Activity implements
final int position = ((AdapterContextMenuInfo) menuInfo).position;
PrinterInfo printer = (PrinterInfo) mListView.getAdapter().getItem(position);
+ // Printer is null if this is a context menu for the "add printer" entry
+ if (printer == null) {
+ return;
+ }
+
menu.setHeaderTitle(printer.getName());
// Add the select menu item if applicable.