From c08dea2aa4f66f888f01fa7ed2be46d4c4651a1e Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 28 Jun 2012 08:35:24 -0700 Subject: [PATCH] Fix NPEs when using the APIs a little oddly. This should help developers use some of the features of Style via subclassing rather than duplicating functionality. Bug: 6716608 Change-Id: I048e8221c8046e9779e08e6e262ac3fb37b01cb3 --- core/java/android/app/Notification.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 8220fd908c284..ceb8cde5087e6 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1367,7 +1367,9 @@ public class Notification implements Parcelable public Builder setStyle(Style style) { if (mStyle != style) { mStyle = style; - mStyle.setBuilder(this); + if (mStyle != null) { + mStyle.setBuilder(this); + } } return this; } @@ -1637,7 +1639,9 @@ public class Notification implements Parcelable public void setBuilder(Builder builder) { if (mBuilder != builder) { mBuilder = builder; - mBuilder.setStyle(this); + if (mBuilder != null) { + mBuilder.setStyle(this); + } } }