An empty array is truthy, [0] potentially isn't (#7961)

This commit is contained in:
Alex van Andel
2023-03-28 00:16:52 +02:00
committed by GitHub
parent a2457ab619
commit be6cf4705c
@@ -494,7 +494,7 @@ async function handler(req: CustomRequest) {
bookingToDelete.user.credentials
.filter((credential) => credential.type.endsWith("_video"))
.forEach((credential) => {
const uidToDelete = bookingToDelete?.references?.[0].uid ?? bookingToDelete.uid;
const uidToDelete = bookingToDelete?.references?.[0]?.uid ?? bookingToDelete.uid;
apiDeletes.push(deleteMeeting(credential, uidToDelete));
});
}