From a58a1eb766ec9beceb481d4d3523d28e5adfe448 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sun, 17 Aug 2025 22:19:08 +0200 Subject: [PATCH] Added null check --- .../views/home/active_game/round_view.dart | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/presentation/views/home/active_game/round_view.dart b/lib/presentation/views/home/active_game/round_view.dart index 614f39e..14b1f94 100644 --- a/lib/presentation/views/home/active_game/round_view.dart +++ b/lib/presentation/views/home/active_game/round_view.dart @@ -379,14 +379,17 @@ class _RoundViewState extends State { FocusScope.of(context) .requestFocus(_focusNodeList[originalIndices[currentPos + 1]]); - WidgetsBinding.instance.addPostFrameCallback((_) { - Scrollable.ensureVisible( - _textFieldKeys[nextIndex].currentContext!, - duration: const Duration(milliseconds: 300), - curve: Curves.easeOut, - alignment: 0.55, - ); - }); + final scrollContext = _textFieldKeys[nextIndex].currentContext; + if (scrollContext != null) { + WidgetsBinding.instance.addPostFrameCallback((_) { + Scrollable.ensureVisible( + scrollContext, + duration: const Duration(milliseconds: 300), + curve: Curves.easeOut, + alignment: 0.55, + ); + }); + } } else { _focusNodeList[index].unfocus(); }