diff --git a/lib/utils/storage_pref.dart b/lib/utils/storage_pref.dart index 778988347..eb796edab 100644 --- a/lib/utils/storage_pref.dart +++ b/lib/utils/storage_pref.dart @@ -107,7 +107,7 @@ abstract class Pref { static List> get blockSettings { final list = _setting.get(SettingBoxKey.blockSettings) as List?; - if (list == null) { + if (list == null || list.length != SegmentType.values.length) { return SegmentType.values .map((i) => Pair(first: i, second: SkipType.skipOnce)) .toList(); @@ -116,8 +116,7 @@ abstract class Pref { .map( (item) => Pair( first: item, - second: SkipType - .values[list.getOrNull(item.index) ?? SkipType.skipOnce.index], + second: SkipType.values[list[item.index]], ), ) .toList(); @@ -125,7 +124,7 @@ abstract class Pref { static List get blockColor { final list = _setting.get(SettingBoxKey.blockColor) as List?; - if (list == null) { + if (list == null || list.length != SegmentType.values.length) { return SegmentType.values.map((i) => i.color).toList(); } return SegmentType.values.map(