diff --git a/src/main/java/org/sunbird/cbp/service/CbPlanServiceImpl.java b/src/main/java/org/sunbird/cbp/service/CbPlanServiceImpl.java index c15ccb349..31c2681e6 100644 --- a/src/main/java/org/sunbird/cbp/service/CbPlanServiceImpl.java +++ b/src/main/java/org/sunbird/cbp/service/CbPlanServiceImpl.java @@ -498,7 +498,9 @@ public SBApiResponse getCBPlanListForUser(String userOrgId, String authTokenOrUs } else { contentDetails = (Map) courseDetailsMap.get(courseId); } - courseList.add(contentDetails); + if (MapUtils.isNotEmpty(contentDetails)) { + courseList.add(contentDetails); + } } cbPlanDetails.put(Constants.CB_CONTENT_LIST, courseList); resultMap.add(cbPlanDetails); @@ -656,9 +658,7 @@ private Map populateReadData(Map cbPlan) throws } } } - if (CollectionUtils.isNotEmpty(enrichContentInfoMap)) { - enrichData.put(Constants.CONTENT_LIST, enrichContentInfoMap); - } + enrichData.put(Constants.CONTENT_LIST, enrichContentInfoMap); return enrichData; } @@ -903,7 +903,9 @@ public SBApiResponse listCbPlan(SunbirdApiRequest request, String userOrgId, Str } } } - courseMapList.add(courseInfoMap.get(contentId)); + if (courseInfoMap.containsKey(contentId)) { + courseMapList.add(courseInfoMap.get(contentId)); + } } cbPlan.put(Constants.CB_CONTENT_LIST, courseMapList);