summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorishowta <kinironote@gmail.com>2018-11-21 19:56:38 +0900
committerAndreas Rumpf <rumpf_a@web.de>2018-11-21 11:56:38 +0100
commit6ff596d4f8fec289c827a5be2edd6646e6a20bb4 (patch)
tree43dfa3b3654a315e3580cf1763fad92e50b6eaaf /lib/system.nim
parentb78699917e9c993bca04c262b909ea8b13aa2724 (diff)
downloadNim-6ff596d4f8fec289c827a5be2edd6646e6a20bb4.tar.gz
Empty check in shallow [backport] (#9676)
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index ace3f5e38..a7b22a283 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -4017,6 +4017,7 @@ proc shallow*[T](s: var seq[T]) {.noSideEffect, inline.} =
   ## marks a sequence `s` as `shallow`:idx:. Subsequent assignments will not
   ## perform deep copies of `s`. This is only useful for optimization
   ## purposes.
+  if s.len == 0: return
   when not defined(JS) and not defined(nimscript):
     var s = cast[PGenericSeq](s)
     s.reserved = s.reserved or seqShallowFlag