Fix NPE on modes page when schedule has no days

Fixes: 387088843
Test: atest ZenModeTriggerUpdatePreferenceControllerTest
Flag: EXEMPT trivial bugfix
Change-Id: I3b845784f5923521d7f3f6cae9d6d27a21f55361
This commit is contained in:
Matías Hernández
2025-01-08 19:11:59 +01:00
parent 837a3477ab
commit 5098df9b6c
2 changed files with 24 additions and 3 deletions

View File

@@ -109,9 +109,11 @@ class ZenModeTriggerUpdatePreferenceController extends AbstractZenModePreference
tryParseScheduleConditionId(mode.getRule().getConditionId());
if (schedule != null) {
preference.setTitle(SystemZenRules.getTimeSummary(mContext, schedule));
preference.setSummary(Utils.createAccessibleSequence(
SystemZenRules.getDaysOfWeekShort(mContext, schedule),
SystemZenRules.getDaysOfWeekFull(mContext, schedule)));
String shortDaysSummary = SystemZenRules.getDaysOfWeekShort(mContext, schedule);
String fullDaysSummary = SystemZenRules.getDaysOfWeekFull(mContext, schedule);
preference.setSummary(shortDaysSummary != null && fullDaysSummary != null
? Utils.createAccessibleSequence(shortDaysSummary, fullDaysSummary)
: shortDaysSummary);
} else {
// Fallback, but shouldn't happen.
Log.wtf(TAG, "SCHEDULE_TIME mode without schedule: " + mode);