Skip to content

Commit 56e4444

Browse files
committed
another guard
1 parent 4387bce commit 56e4444

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/api3/generic/search/operation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ async function search (opCtx) {
4242
, onlyValid });
4343

4444
if (!result)
45-
throw new Error('empty result'); result.forEach(col.resolveDates);
46-
45+
throw new Error('empty result');
46+
result.forEach(col.resolveDates);
4747
result.forEach(fieldsProjector.applyProjection);
4848

4949
res.status(apiConst.HTTP.OK);

lib/data/dataloader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ function mergeProcessSort(oldData, newData, ageLimit) {
3939
if (oldData && filtered) {
4040
merged = filtered; // Start with the new / updated data
4141
for (let i = 0; i < oldData.length; i++) {
42-
const oldElement = oldData[i];
42+
const oldElement = oldData?.[i];
4343
let found = false;
4444
for (let j = 0; j < filtered.length; j++) {
45-
if (oldElement._id == filtered[j]._id) {
45+
if (oldElement?._id == filtered[j]._id) {
4646
found = true;
4747
break;
4848
}

0 commit comments

Comments
 (0)