Skip to content

Commit 1351d2f

Browse files
committed
fix: more defensive programming for this.activeQuery
1 parent 049d9b1 commit 1351d2f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/pg/lib/client.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,27 +358,27 @@ class Client extends EventEmitter {
358358

359359
_handleRowDescription(msg) {
360360
// delegate rowDescription to active query
361-
this.activeQuery.handleRowDescription(msg)
361+
this.activeQuery?.handleRowDescription(msg)
362362
}
363363

364364
_handleDataRow(msg) {
365365
// delegate dataRow to active query
366-
this.activeQuery.handleDataRow(msg)
366+
this.activeQuery?.handleDataRow(msg)
367367
}
368368

369369
_handlePortalSuspended(msg) {
370370
// delegate portalSuspended to active query
371-
this.activeQuery.handlePortalSuspended(this.connection)
371+
this.activeQuery?.handlePortalSuspended(this.connection)
372372
}
373373

374374
_handleEmptyQuery(msg) {
375375
// delegate emptyQuery to active query
376-
this.activeQuery.handleEmptyQuery(this.connection)
376+
this.activeQuery?.handleEmptyQuery(this.connection)
377377
}
378378

379379
_handleCommandComplete(msg) {
380380
// delegate commandComplete to active query
381-
this.activeQuery.handleCommandComplete(msg, this.connection)
381+
this.activeQuery?.handleCommandComplete(msg, this.connection)
382382
}
383383

384384
_handleParseComplete(msg) {
@@ -391,11 +391,11 @@ class Client extends EventEmitter {
391391
}
392392

393393
_handleCopyInResponse(msg) {
394-
this.activeQuery.handleCopyInResponse(this.connection)
394+
this.activeQuery?.handleCopyInResponse(this.connection)
395395
}
396396

397397
_handleCopyData(msg) {
398-
this.activeQuery.handleCopyData(msg, this.connection)
398+
this.activeQuery?.handleCopyData(msg, this.connection)
399399
}
400400

401401
_handleNotification(msg) {

packages/pg/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "so-pg",
3-
"version": "8.12.1",
3+
"version": "8.12.2",
44
"description": "PostgreSQL client - pure javascript & libpq with the same API",
55
"keywords": [
66
"database",

0 commit comments

Comments
 (0)