3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-03-11 02:49:18 +00:00

Check that there is a valid array before unshifting

This commit is contained in:
snipe
2017-11-04 01:11:11 -07:00
parent adf6afbb43
commit 2de0a3669e

View File

@ -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' =>