From 949d81371549710d95d43b1c6e7403656ab0cfb6 Mon Sep 17 00:00:00 2001 From: Beverly Date: Wed, 16 Aug 2017 15:00:28 -0400 Subject: [PATCH] Null-pointer check when updating name of ZenRule. Test: manual, current tests pass Fixes: 64758679 Change-Id: Ia94b1749afdc6db4780bd09a5794f4110d4d032d --- .../notification/ZenModeRuleSettingsBase.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java index 5629b173335..4abdd7e9267 100644 --- a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java +++ b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java @@ -16,6 +16,7 @@ package com.android.settings.notification; +import android.app.Activity; import android.app.AlertDialog; import android.app.AutomaticZenRule; import android.app.NotificationManager; @@ -262,8 +263,14 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase } private void updateRuleName() { - getActivity().setTitle(mRule.getName()); - mRuleName.setSummary(mRule.getName()); + Activity activity = getActivity(); + if (activity != null) { + activity.setTitle(mRule.getName()); + mRuleName.setSummary(mRule.getName()); + } else { + if (DEBUG) Log.d(TAG, "updateRuleName - activity title and mRuleName " + + "not updated; getActivity() returned null"); + } } private AutomaticZenRule getZenRule() {