mirror of https://github.com/status-im/nim-rlp.git
Fix assertion failure on empty byte range
This commit is contained in:
parent
d75b09795b
commit
da70fbc898
3
rlp.nim
3
rlp.nim
|
@ -223,9 +223,10 @@ proc toBytes*(self: Rlp): BytesRange =
|
||||||
raise newException(RlpTypeMismatch,
|
raise newException(RlpTypeMismatch,
|
||||||
"Bytes expected, but the source RLP in not a blob")
|
"Bytes expected, but the source RLP in not a blob")
|
||||||
|
|
||||||
|
let payloadLen = payloadBytesCount()
|
||||||
|
if payloadLen > 0:
|
||||||
let
|
let
|
||||||
payloadOffset = payloadOffset()
|
payloadOffset = payloadOffset()
|
||||||
payloadLen = payloadBytesCount()
|
|
||||||
ibegin = position + payloadOffset
|
ibegin = position + payloadOffset
|
||||||
iend = ibegin + payloadLen - 1
|
iend = ibegin + payloadLen - 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue