From 94addf4ca96f537ba24da4d4ef94d5333ed6490e Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Tue, 24 Dec 2013 10:00:51 +0400 Subject: [PATCH] Correct SqlResultProvider::fetchField() to work with empty results. --- model/SqlResultProvider.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/SqlResultProvider.php b/model/SqlResultProvider.php index 78534d9..0bae36f 100644 --- a/model/SqlResultProvider.php +++ b/model/SqlResultProvider.php @@ -76,7 +76,11 @@ class SqlResultProvider */ public function fetchField($field) { - return current($this->result_items)->{$field}; + $item = current($this->result_items); + if ($item) { + return $item->{$field}; + } + return false; } public function fetch()