Authored by Rock Zhang

修复当接口返回的品类数据为空时,搜索列表会报错的bug

Code Review By Rock Zhang
@@ -113,6 +113,11 @@ class SearchController extends AbstractAction @@ -113,6 +113,11 @@ class SearchController extends AbstractAction
113 $classNames = Category\ClassModel::getClassNames(); 113 $classNames = Category\ClassModel::getClassNames();
114 114
115 do { 115 do {
  116 + // 品类名称为空时跳出
  117 + if (empty($classNames)) {
  118 + break;
  119 + }
  120 +
116 /* 精确查一级品类 */ 121 /* 精确查一级品类 */
117 $sorts = array_keys($classNames['first'], $query, true); 122 $sorts = array_keys($classNames['first'], $query, true);
118 if (isset($sorts[0])) { 123 if (isset($sorts[0])) {