Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccb52608 authored by Vlad Popa's avatar Vlad Popa
Browse files

CSD: Fix possible NPE when no records are stored

Add check when settings do not contain any sound dose records.

Test: flash -w and check persistence
Bug: 264254900
Change-Id: I9963022bb99723afdaca6d81caad823c9f5a933c
parent aabd1baa
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -595,9 +595,12 @@ public class SoundDoseHelper {
                        Settings.Global.AUDIO_SAFE_CSD_CURRENT_VALUE, /* defaultValue= */0.f);
                mNextCsdWarning = parseGlobalSettingFloat(
                        Settings.Global.AUDIO_SAFE_CSD_NEXT_WARNING, /* defaultValue= */1.f);
                mDoseRecords.addAll(persistedStringToRecordList(
                final List<SoundDoseRecord> records = persistedStringToRecordList(
                        mSettings.getGlobalString(mAudioService.getContentResolver(),
                                Settings.Global.AUDIO_SAFE_CSD_DOSE_RECORDS)));
                                Settings.Global.AUDIO_SAFE_CSD_DOSE_RECORDS));
                if (records != null) {
                    mDoseRecords.addAll(records);
                }
            }

            reset();