From bf0d24a96f0df6a3e207035b95051c340f7d79f9 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Tue, 31 Jan 2017 23:08:56 +0000 Subject: [PATCH] Fix bugs (#1026) --- application/controllers/Items.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/controllers/Items.php b/application/controllers/Items.php index 262d4fedd..9a03d4031 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -219,9 +219,12 @@ class Items extends Secure_Controller // try to update pic_filename in db, following 3 lines might not be necessary // after what I put in search(), feel free to remove it if you also think it's // redundant. - $new_pic_filename = pathinfo($images[0], PATHINFO_BASENAME); - $item_data = array('pic_filename' => $new_pic_filename); - $this->Item->save($item_data, $item_id); + if(sizeof($images) > 0) + { + $new_pic_filename = pathinfo($images[0], PATHINFO_BASENAME); + $item_data = array('pic_filename' => $new_pic_filename); + $this->Item->save($item_data, $item_id); + } } else {