Add sanity check. (#105)

This commit is contained in:
Eugene Kabanov 2020-06-25 09:32:41 +03:00 committed by GitHub
parent 319e2bfc09
commit 528688d01e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1143,7 +1143,7 @@ else:
var transp = cast[StreamTransport](cdata.udata)
let fd = SocketHandle(cdata.fd)
if int(fd) == 0:
if int(fd) == 0 or isNil(transp):
## This situation can be happen, when there events present
## after transport was closed.
return
@ -1286,7 +1286,7 @@ else:
var cdata = cast[ptr CompletionData](udata)
var transp = cast[StreamTransport](cdata.udata)
let fd = SocketHandle(cdata.fd)
if int(fd) == 0:
if int(fd) == 0 or isNil(transp):
## This situation can be happen, when there events present
## after transport was closed.
return