diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-04-29 01:48:21 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-29 01:48:21 +0200 |
commit | b899713832a9fd9523117dfccc3b893825bad454 (patch) | |
tree | 6643cd5707d41bbda3b2898caedd19ca987e0b3d | |
parent | f4c21305a9c0fdbc1f1225dffec022dbc88df67c (diff) | |
download | Nim-b899713832a9fd9523117dfccc3b893825bad454.tar.gz |
make more tests green
-rw-r--r-- | lib/pure/collections/critbits.nim | 4 | ||||
-rw-r--r-- | lib/pure/ospaths.nim | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/collections/critbits.nim b/lib/pure/collections/critbits.nim index 34f5c5470..ed8583ae5 100644 --- a/lib/pure/collections/critbits.nim +++ b/lib/pure/collections/critbits.nim @@ -74,11 +74,11 @@ proc rawInsert[T](c: var CritBitTree[T], key: string): Node[T] = var newByte = 0 block blockX: while newbyte < key.len: - if it.key[newbyte] != key[newbyte]: + if newbyte >= it.key.len or it.key[newbyte] != key[newbyte]: newotherbits = it.key[newbyte].ord xor key[newbyte].ord break blockX inc newbyte - if it.key[newbyte] != '\0': + if newbyte < it.key.len: newotherbits = it.key[newbyte].ord else: return it diff --git a/lib/pure/ospaths.nim b/lib/pure/ospaths.nim index 0d638abb9..aeb4a149e 100644 --- a/lib/pure/ospaths.nim +++ b/lib/pure/ospaths.nim @@ -196,7 +196,7 @@ proc joinPath*(head, tail: string): string {. else: result = head & tail else: - if tail[0] in {DirSep, AltSep}: + if tail.len > 0 and tail[0] in {DirSep, AltSep}: result = head & tail else: result = head & DirSep & tail |