Skip to content

Commit 4db0808

Browse files
committed
Merge pull request laravel#1089 from kbanman/fix-query-lists
Fix Query::lists() for empty resultsets
2 parents 4a60981 + e3a000a commit 4db0808

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

laravel/database/query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public function lists($column, $key = null)
621621
// set the keys on the array of values using the array_combine
622622
// function provided by PHP, which should give us the proper
623623
// array form to return from the method.
624-
if ( ! is_null($key))
624+
if ( ! is_null($key) && count($results))
625625
{
626626
return array_combine(array_map(function($row) use ($key)
627627
{

0 commit comments

Comments
 (0)