summary refs log tree commit diff stats
path: root/lib/pure/includes/oserr.nim
diff options
context:
space:
mode:
authorKobi <kobi2187@gmail.com>2019-01-19 14:31:14 +0200
committerDominik Picheta <dominikpicheta@googlemail.com>2019-01-19 10:56:36 -0800
commit28b3c8d74dcc3b812c2a386af68a39d3f746edcc (patch)
tree7a662ae73bbebaf1eaf22e352296a4ad49d8ec74 /lib/pure/includes/oserr.nim
parent095eaacf21a80c72d15ba9a7a422ddc192124ae1 (diff)
downloadNim-28b3c8d74dcc3b812c2a386af68a39d3f746edcc.tar.gz
prevent index out of bounds error in oserr.nim
Diffstat (limited to 'lib/pure/includes/oserr.nim')
-rw-r--r--lib/pure/includes/oserr.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/includes/oserr.nim b/lib/pure/includes/oserr.nim
index 9ae06f5bc..db7d84c1e 100644
--- a/lib/pure/includes/oserr.nim
+++ b/lib/pure/includes/oserr.nim
@@ -59,7 +59,7 @@ proc raiseOSError*(errorCode: OSErrorCode; additionalInfo = "") {.noinline.} =
   e.errorCode = errorCode.int32
   e.msg = osErrorMsg(errorCode)
   if additionalInfo.len > 0:
-    if e.msg[^1] != '\n': e.msg.add '\n'
+    if e.msg.len > 0 and e.msg[^1] != '\n': e.msg.add '\n'
     e.msg.add  "Additional info: "
     e.msg.addQuoted additionalInfo
   if e.msg == "":