From 05902aa39843613ea93dd0c1b41d561d4ea85ff9 Mon Sep 17 00:00:00 2001 From: Michael Kolb Date: Tue, 22 Feb 2011 17:43:38 -0800 Subject: fix NPE in drawClipped Bug: 3416053 only call draw clipped with instantiated shaders Change-Id: Ib8d2f2bc37c8d4a4d0660e6bc745dea2733e5f32 --- src/com/android/browser/TabBar.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java index 9da1927..1d17cb3 100644 --- a/src/com/android/browser/TabBar.java +++ b/src/com/android/browser/TabBar.java @@ -475,12 +475,14 @@ public class TabBar extends LinearLayout mInactiveShaderPaint.setShader(mInactiveShader); } } - - int state = canvas.save(); - getLocationInWindow(mWindowPos); - Paint paint = mSelected ? mActiveShaderPaint : mInactiveShaderPaint; - drawClipped(canvas, paint, mPath, mWindowPos[0]); - canvas.restoreToCount(state); + // add some monkey protection + if ((mActiveShader != null) && (mInactiveShader != null)) { + int state = canvas.save(); + getLocationInWindow(mWindowPos); + Paint paint = mSelected ? mActiveShaderPaint : mInactiveShaderPaint; + drawClipped(canvas, paint, mPath, mWindowPos[0]); + canvas.restoreToCount(state); + } super.dispatchDraw(canvas); } -- cgit v1.1