Fix potential NPE crash in ConversationHeaderPreferenceController
mChannel is nullable and we have to do a null-check before calling its method. Bug: 245506600 Test: manual and atest Change-Id: Ib739f0f66f1a2aee1b2741263e7c206341782892
This commit is contained in:
@@ -126,8 +126,12 @@ public class ConversationHeaderPreferenceController extends NotificationPreferen
|
||||
|
||||
@VisibleForTesting
|
||||
CharSequence getLabel() {
|
||||
return mConversationInfo != null
|
||||
? mConversationInfo.getLabel()
|
||||
: mChannel.getName();
|
||||
CharSequence label = null;
|
||||
if (mConversationInfo != null) {
|
||||
label = mConversationInfo.getLabel();
|
||||
} else if (mChannel != null) {
|
||||
label = mChannel.getName();
|
||||
}
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user