Handle empty array_agg in I18nInput.FillArray

array_agg returns [null] instead of [] when it can not find any rows,
thus the range enters the loop, but it fails to convert the null to
string.
This commit is contained in:
jordi fita mas 2024-01-12 19:28:13 +01:00
parent 2cbdc21e53
commit 3d0f7b0dc1
1 changed files with 5 additions and 1 deletions

View File

@ -76,7 +76,11 @@ func (input I18nInput) FillValue(r *http.Request) {
func (input I18nInput) FillArray(array database.RecordArray) error {
for _, el := range array.Elements {
tag, err := language.Parse(el.Fields[0].Get().(string))
lang := el.Fields[0].Get()
if lang == nil {
continue
}
tag, err := language.Parse(lang.(string))
if err != nil {
return err
}