Authored by chenl

增加get 保护 review by yuliang。

... ... @@ -74,12 +74,12 @@ export function pressCategoryBMore(category_id){
let {categoryB} = getState();
//获取当前频道下一级分类列表信息
let categoryData = categoryB.categoryList.get(categoryB.currentChannelValue);
let categoryData = categoryB.categoryList ? categoryB.categoryList.get(categoryB.currentChannelValue) : [];
//获取指定category_id分类信息
let category = null;
categoryData.map((item, i) => {
if(category_id == item.get('category_id')){
if(item && (category_id == item.get('category_id'))){
category = item;
}
});
... ... @@ -92,7 +92,7 @@ export function pressCategoryBMore(category_id){
};
//设置当前的类别信息
dispatch(setCurrentCateB(category_id, category.get('category_name')));
dispatch(setCurrentCateB(category_id, category ? category.get('category_name') : ""));
dispatch(jumpToCategory(all, 0, categoryB.currentChannelId));
};
... ... @@ -113,7 +113,7 @@ export function getCategoryBSubCategoryDetail(category_id, category_value){
//检查缓存是否存在数据,如果不存在则获取
let cache = categoryB.cacheSubCateData;
let key = getSubDetailCacheKey(currentChannelId, category_id);
let categoryData = cache.get(key);
let categoryData = cache ? cache.get(key) : "";
//设置当前的类别信息
dispatch(setCurrentCateB(category_id, category_value));
... ... @@ -201,7 +201,10 @@ export function getCategoryBFirstSubCategoryDetail(channel_id) {
else if(channel_id == '4'){
category = categoryList.get('lifestyle').get(0);
}
dispatch(getCategoryBSubCategoryDetail(category.get('category_id'), category.get('category_name')));
let category_id = category ? category.get('category_id') : "";
let category_name = category ? category.get('category_name') : "";
dispatch(getCategoryBSubCategoryDetail(category_id, category_name));
};
}
... ...