Fatal error in AiTranslateForm if no ai model is selected (php 8.3)
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3488007. -->
Reported by: [nils.destoop](https://www.drupal.org/user/361625)
Related to !276
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>When you installed the module, but no providers yet. The AiTranslateForm triggers an error + a warning:</p>
<p><code>Warning: Undefined array key 1 in Drupal\ai_translate\Form\AiTranslateForm->buildForm() (line 116 of /var/www/html/modules/contrib/ai/modules/ai_translate/src/Form/AiTranslateForm.php)</code></p>
<pre>TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 431 of /var/www/html/core/lib/Drupal/Component/Utility/Html.php).<br>Severity Error</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>- Install the ai module and the ai translate module, but no providers.<br>
- Go the the translate tab of a node.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Add type checks on the ai mode.</p>
issue