Authored by hugufei

空指针修复

@@ -120,6 +120,9 @@ public class QueryUserPersionalFactorBean { @@ -120,6 +120,9 @@ public class QueryUserPersionalFactorBean {
120 } 120 }
121 121
122 private Map<Integer, List<Integer>> getPageBrand2MiSortIdsMap(PagePersonalFactor pageFactor){ 122 private Map<Integer, List<Integer>> getPageBrand2MiSortIdsMap(PagePersonalFactor pageFactor){
  123 + if(pageFactor==null || pageFactor.getBrandSortsList()==null){
  124 + return new HashMap<>();
  125 + }
123 //1、构造brand2MiSortIdsMap 126 //1、构造brand2MiSortIdsMap
124 List<PageBrandSorts> brandSortsList = pageFactor.getBrandSortsList(); 127 List<PageBrandSorts> brandSortsList = pageFactor.getBrandSortsList();
125 Map<Integer, List<Integer>> brand2MiSortIdsMap = new HashMap<>(); 128 Map<Integer, List<Integer>> brand2MiSortIdsMap = new HashMap<>();
@@ -131,6 +134,9 @@ public class QueryUserPersionalFactorBean { @@ -131,6 +134,9 @@ public class QueryUserPersionalFactorBean {
131 134
132 private List<SortBrand> getSortBrandListWithSort(Map<Integer, List<Integer>> brand2MiSortIdsMap,List<SortBrand> userSortBrands,int maxCount){ 135 private List<SortBrand> getSortBrandListWithSort(Map<Integer, List<Integer>> brand2MiSortIdsMap,List<SortBrand> userSortBrands,int maxCount){
133 List<SortBrand> results = new ArrayList<>(); 136 List<SortBrand> results = new ArrayList<>();
  137 + if(brand2MiSortIdsMap==null || brand2MiSortIdsMap.isEmpty() || userSortBrands==null || userSortBrands.isEmpty()){
  138 + return results;
  139 + }
134 for (SortBrand sortBrand :userSortBrands) { 140 for (SortBrand sortBrand :userSortBrands) {
135 if (!brand2MiSortIdsMap.containsKey(sortBrand.getBrandId())) { 141 if (!brand2MiSortIdsMap.containsKey(sortBrand.getBrandId())) {
136 continue; 142 continue;
@@ -3,6 +3,7 @@ package com.yoho.search.recall.scene.models.personal; @@ -3,6 +3,7 @@ package com.yoho.search.recall.scene.models.personal;
3 import com.yoho.search.core.personalized.models.SortBrand; 3 import com.yoho.search.core.personalized.models.SortBrand;
4 import com.yoho.search.core.personalized.models.SortPriceAreas; 4 import com.yoho.search.core.personalized.models.SortPriceAreas;
5 5
  6 +import java.util.ArrayList;
6 import java.util.List; 7 import java.util.List;
7 8
8 public class UserPersonalFactor { 9 public class UserPersonalFactor {