Skip to content

Commit c08dea2

Browse files
committed
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
1 parent 4708d8f commit c08dea2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/java/android/app/Notification.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,9 @@ public Builder addAction(int icon, CharSequence title, PendingIntent intent) {
13671367
public Builder setStyle(Style style) {
13681368
if (mStyle != style) {
13691369
mStyle = style;
1370-
mStyle.setBuilder(this);
1370+
if (mStyle != null) {
1371+
mStyle.setBuilder(this);
1372+
}
13711373
}
13721374
return this;
13731375
}
@@ -1637,7 +1639,9 @@ protected void internalSetSummaryText(CharSequence cs) {
16371639
public void setBuilder(Builder builder) {
16381640
if (mBuilder != builder) {
16391641
mBuilder = builder;
1640-
mBuilder.setStyle(this);
1642+
if (mBuilder != null) {
1643+
mBuilder.setStyle(this);
1644+
}
16411645
}
16421646
}
16431647

0 commit comments

Comments
 (0)