Skip to content

Commit

Permalink
Fix 500 error in data service #2670
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Apr 26, 2022
1 parent 6b93540 commit a195468
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data-serving/data-service/src/controllers/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const caseFromDTO = async (receivedCase: CaseDTO) => {

const dtoFromCase = async (storedCase: LeanDocument<CaseDocument>) => {
let dto = storedCase as unknown as CaseDTO;
if (storedCase.demographics.ageBuckets && storedCase.demographics.ageBuckets.length > 0) {
if (storedCase.demographics && storedCase.demographics.ageBuckets && storedCase.demographics.ageBuckets.length > 0) {
const ageBuckets = await Promise.all(storedCase.demographics.ageBuckets.map((bucketId) => {
return AgeBucket.findById(bucketId).lean()
}));
Expand Down

0 comments on commit a195468

Please sign in to comment.