Skip to content

Commit

Permalink
Fix destroy before connected
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed Dec 26, 2019
1 parent 0f08fb9 commit f682ca1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function Connection(options = {}) {
onnotice,
parsers
} = options

let buffer = Buffer.alloc(0)
let length = 0
let messages = []
Expand Down Expand Up @@ -230,7 +229,7 @@ function postgresSocket(options, {
ready: false,
write: x => socket.write(x),
destroy: () => {
socket.destroy()
socket && socket.destroy()
return Promise.resolve()
},
end: () => {
Expand Down

0 comments on commit f682ca1

Please sign in to comment.