diff options
author | Stuart Stock <stuart@int08h.com> | 2018-03-18 22:08:16 -0500 |
---|---|---|
committer | Stuart Stock <stuart@int08h.com> | 2018-03-18 22:08:16 -0500 |
commit | 1ce57a140bcdd1c0c6dfbef1403a1aa11e2240ae (patch) | |
tree | 684146b8abde757510b337ba617e03fa236d96f9 /src/message.rs | |
parent | f80c952f6f25b09946a288a51be8016849957553 (diff) | |
download | roughenough-1ce57a140bcdd1c0c6dfbef1403a1aa11e2240ae.zip |
Return Error on invalid offset instead of panic'ing
Diffstat (limited to 'src/message.rs')
-rw-r--r-- | src/message.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/message.rs b/src/message.rs index 11cad2b..8766a8c 100644 --- a/src/message.rs +++ b/src/message.rs @@ -67,7 +67,7 @@ impl RtMessage { for _ in 0..num_tags - 1 { let offset = msg.read_u32::<LittleEndian>()?; if offset % 4 != 0 { - panic!("Invalid offset {:?} in message {:?}", offset, bytes); + return Err(Error::InvalidOffsetAlignment(offset)); } offsets.push(offset as usize); } |