summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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 == "":