prevent null dereference (#13)

This commit is contained in:
Mamy Ratsimbazafy 2019-09-11 12:41:51 -04:00 committed by GitHub
parent 24474e69d1
commit 80da30b031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -89,7 +89,10 @@ template loadFile*(Format: distinct type,
params: varargs[untyped]): auto =
mixin init, ReaderType
var stream = openFile(filename)
defer: stream[].close() # TODO: destructors
defer:
# TODO: destructors
if not stream.isNil:
stream[].close()
# TODO:
# Remove this when statement once the following bug is fixed: