Skip to content

Commit

Permalink
fix(NODE-4831): check for null
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Nov 22, 2022
1 parent eedc66f commit 48244b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/cmap/connection.ts
Expand Up @@ -384,8 +384,7 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
} else {
// Get the first orphaned operation description.
const entry = this[kQueue].entries().next();
/* eslint no-restricted-syntax: 0 */
if (entry.value !== undefined) {
if (entry.value != null) {
const [requestId, orphaned]: [number, OperationDescription] = entry.value;
// If the orphaned operation description exists then set it.
operationDescription = orphaned;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/cmap/connection.test.ts
Expand Up @@ -311,7 +311,7 @@ describe('new Connection()', function () {
const message = new BinMsg(msg, msgHeader, msgBody);
expect(() => {
connection.onMessage(message);
}).to.not.throw(/undefined is not iterable/);
}).to.not.throw();
});
});

Expand Down

0 comments on commit 48244b6

Please sign in to comment.