修复当接口返回的品类数据为空时,搜索列表会报错的bug
Code Review By Rock Zhang
Showing
1 changed file
with
5 additions
and
0 deletions
@@ -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])) { |
-
Please register or login to post a comment