From df9f8e09161da7093b9aea25f36fd98d11c9a9fc Mon Sep 17 00:00:00 2001 From: ggurdin Date: Fri, 25 Oct 2024 11:37:36 -0400 Subject: [PATCH] prevent null check error in send button --- lib/pangea/choreographer/controllers/choreographer.dart | 1 + lib/pangea/choreographer/widgets/send_button.dart | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pangea/choreographer/controllers/choreographer.dart b/lib/pangea/choreographer/controllers/choreographer.dart index f3e48a8b6..63895d550 100644 --- a/lib/pangea/choreographer/controllers/choreographer.dart +++ b/lib/pangea/choreographer/controllers/choreographer.dart @@ -593,6 +593,7 @@ class Choreographer { if (isFetching) return false; if (errorService.isError) return true; if (itEnabled && isRunningIT) return false; + if (igc.igcTextData == null) return false; final hasITMatches = igc.igcTextData!.matches.any((match) => match.isITStart); diff --git a/lib/pangea/choreographer/widgets/send_button.dart b/lib/pangea/choreographer/widgets/send_button.dart index f5e358a31..6fba75395 100644 --- a/lib/pangea/choreographer/widgets/send_button.dart +++ b/lib/pangea/choreographer/widgets/send_button.dart @@ -56,7 +56,10 @@ class ChoreographerSendButtonState extends State { color: widget.controller.choreographer.assistanceState .stateColor(context), onPressed: () { - widget.controller.choreographer.send(context); + widget.controller.choreographer.canSendMessage + ? widget.controller.choreographer.send(context) + : widget.controller.choreographer.igc + .showFirstMatch(context); }, tooltip: L10n.of(context)!.send, ),