From 925175b0e5183a8b21aced32e7372c4cc3a9364e Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sun, 16 Nov 2025 15:19:51 +0100 Subject: [PATCH] Handle case where no page can be found Note that this shouldn't actually happen, we should find a proper solution --- lib/widgets/routines/gym_mode/log_page.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/widgets/routines/gym_mode/log_page.dart b/lib/widgets/routines/gym_mode/log_page.dart index 322a3fb6..a2ad204b 100644 --- a/lib/widgets/routines/gym_mode/log_page.dart +++ b/lib/widgets/routines/gym_mode/log_page.dart @@ -71,11 +71,15 @@ class _LogPageState extends ConsumerState { final theme = Theme.of(context); final state = ref.watch(gymStateProvider); - final page = state.getPageByIndex()!; - final slotEntryPage = state.getSlotEntryPageByIndex(); + final page = state.getPageByIndex(); + if (page == null) { + widget._logger.warning('getPageByIndex returned null, showing empty container'); + return Container(); + } + final slotEntryPage = state.getSlotEntryPageByIndex(); if (slotEntryPage == null) { - widget._logger.finer('getSlotPageByIndex returned null, showing empty container'); + widget._logger.warning('getSlotPageByIndex returned null, showing empty container'); return Container(); }