OSDN Git Service

Fix a crash in pring spooler.
authorSvet Ganov <svetoslavganov@google.com>
Mon, 15 Sep 2014 03:29:27 +0000 (20:29 -0700)
committerSvet Ganov <svetoslavganov@google.com>
Mon, 15 Sep 2014 03:29:30 +0000 (20:29 -0700)
If the printer capabilities are reported with a delay which is pretty
common we were trying to evaluate the preview page dimensions without
having a media size resulting in a NPE.

bug:17501953

Change-Id: I6765137f61b8fd060e9eabff07e632875d934963

packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java

index faaf0ae..13eb73f 100644 (file)
@@ -384,6 +384,10 @@ public final class PageAdapter extends Adapter implements
     }
 
     private void updatePreviewAreaPageSizeAndEmptyState() {
+        if (mMediaSize == null) {
+            return;
+        }
+
         final int availableWidth = mPreviewArea.getWidth();
         final int availableHeight = mPreviewArea.getHeight();