diff options
author | Vindaar <basti90@gmail.com> | 2018-10-20 20:35:04 +0200 |
---|---|---|
committer | Vindaar <basti90@gmail.com> | 2018-10-20 20:35:04 +0200 |
commit | e190f485ae7aaa89c989570c97c199884b66dab6 (patch) | |
tree | f2f8650f14c3dd9dbd50a427c33299c0b39bedc0 /lib/system | |
parent | 863d3ef4ed7d18877a42f0060ebe63c34a27cf32 (diff) | |
download | Nim-e190f485ae7aaa89c989570c97c199884b66dab6.tar.gz |
fixes #9456 by only calling `c_fclose` if non nil
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/sysio.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index 61835e0f7..20964b166 100644 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -130,7 +130,10 @@ else: const BufSize = 4000 -proc close*(f: File) = discard c_fclose(f) +proc close*(f: File) = + if not f.isNil: + discard c_fclose(f) + proc readChar(f: File): char = let x = c_fgetc(f) if x < 0: |