Fix assertion failure on empty byte range

This commit is contained in:
coffeepots 2018-07-16 17:11:56 +01:00 committed by zah
parent d75b09795b
commit da70fbc898
1 changed files with 7 additions and 6 deletions

View File

@ -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