diff --git a/app/Http/Transformers/SelectlistTransformer.php b/app/Http/Transformers/SelectlistTransformer.php index 6aac737b07..e4b6a17a0f 100644 --- a/app/Http/Transformers/SelectlistTransformer.php +++ b/app/Http/Transformers/SelectlistTransformer.php @@ -34,7 +34,10 @@ class SelectlistTransformer // This is weird and awful, but the only way I can find to allow the user to // clear the selection - @snipe - array_unshift($items_array, ['id' =>'', 'text'=> trans('general.clear_selection')]); + if (count($items_array) > 0) { + array_unshift($items_array, ['id' =>'', 'text'=> trans('general.clear_selection')]); + } + $results = [ 'items' => $items_array, 'pagination' =>