Browse Source

Merge pull request #1089 from kbanman/fix-query-lists

Fix Query::lists() for empty resultsets
Taylor Otwell 12 years ago
parent
commit
4db08087f7
1 changed files with 1 additions and 1 deletions
  1. 1 1
      laravel/database/query.php

+ 1 - 1
laravel/database/query.php

@@ -621,7 +621,7 @@ class Query {
 		// set the keys on the array of values using the array_combine
 		// function provided by PHP, which should give us the proper
 		// array form to return from the method.
-		if ( ! is_null($key))
+		if ( ! is_null($key) && count($results))
 		{
 			return array_combine(array_map(function($row) use ($key)
 			{