Skip to content

Commit 9f48f64

Browse files
committed
fix: add null guards to prevent unhandled exceptions
- Add fallback for job.data.data in webhooks worker to prevent TypeError - Reset outlookSubscription to empty object on JSON parse failure to prevent type confusion
1 parent 46cf25a commit 9f48f64

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/email-client/outlook-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3213,7 +3213,7 @@ class OutlookClient extends BaseClient {
32133213
try {
32143214
outlookSubscription = JSON.parse(outlookSubscription);
32153215
} catch (err) {
3216-
// ignore, I guess?
3216+
outlookSubscription = {};
32173217
}
32183218
}
32193219

workers/webhooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ const notifyWorker = new Worker(
293293
{
294294
let filteredSubData = {};
295295
let isPartial = false;
296-
for (let dataKey of Object.keys(job.data.data)) {
296+
for (let dataKey of Object.keys(job.data.data || {})) {
297297
switch (dataKey) {
298298
case 'id':
299299
case 'uid':

0 commit comments

Comments
 (0)