Fix compilation error.

This commit is contained in:
cheatfate 2018-12-14 12:28:22 +02:00
parent a7c54c76fb
commit 8b00514dd7
1 changed files with 3 additions and 3 deletions

View File

@ -607,7 +607,7 @@ proc init*(mtype: typedesc[MultiAddress], value: string): MultiAddress =
"Missing protocol '" & part & "' argument") "Missing protocol '" & part & "' argument")
if proto.kind in {Fixed, Length}: if proto.kind in {Fixed, Length}:
result.data.writeCodec(proto.mcodec) result.data.write(proto.mcodec)
let res = proto.coder.stringToBuffer(parts[offset + 1], result.data) let res = proto.coder.stringToBuffer(parts[offset + 1], result.data)
if not res: if not res:
raise newException(MultiAddressError, raise newException(MultiAddressError,
@ -615,13 +615,13 @@ proc init*(mtype: typedesc[MultiAddress], value: string): MultiAddress =
offset += 2 offset += 2
elif proto.kind == Path: elif proto.kind == Path:
var path = "/" & (parts[(offset + 1)..^1].join("/")) var path = "/" & (parts[(offset + 1)..^1].join("/"))
result.data.writeCodec(proto.mcodec) result.data.write(proto.mcodec)
if not proto.coder.stringToBuffer(path, result.data): if not proto.coder.stringToBuffer(path, result.data):
raise newException(MultiAddressError, raise newException(MultiAddressError,
"Error encoding `$1/$2`" % [part, path]) "Error encoding `$1/$2`" % [part, path])
break break
elif proto.kind == Marker: elif proto.kind == Marker:
result.data.writeCodec(proto.mcodec) result.data.write(proto.mcodec)
offset += 1 offset += 1
result.data.finish() result.data.finish()