Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mobile/apps/auth/lib/ui/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ class _HomePageState extends State<HomePage> {
currentKey: PreferenceService.instance.codeSortKey(),
onSelected: (newOrder) async {
await PreferenceService.instance.setCodeSortKey(newOrder);
if (newOrder == CodeSortKey.manual && newOrder == _codeSortKey) {
if (newOrder == CodeSortKey.manual) {
await navigateToReorderPage(_allCodes!);
}
Comment on lines 1348 to 1353

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard against null codes before navigating to reorder screen

The null assertion _allCodes! is now reached whenever the user taps “Custom order”, even if the codes list has not finished loading. Early in page startup _allCodes is still null, so changing the sort to manual immediately triggers a crash before the codes stream populates. The previous condition required the current sort to already be manual, which significantly reduced the chance of hitting this path before _allCodes was initialized. Consider skipping navigation or awaiting data when _allCodes is null to avoid a runtime exception.

Useful? React with 👍 / 👎.

setState(() {
Expand Down
4 changes: 1 addition & 3 deletions mobile/apps/auth/lib/ui/sort_option_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ class SortCodeMenuWidget extends StatelessWidget {
sortOptionText(CodeSortKey.values[index]),
if (CodeSortKey.values[index] == currentKey)
Icon(
CodeSortKey.values[index] == CodeSortKey.manual
? Icons.mode_edit
: Icons.check,
Icons.check,
color: Theme.of(context).iconTheme.color,
),
],
Expand Down