Skip to content

Commit

Permalink
misc(event_only_sensor): return NotEnoughData in appropriate case
Browse files Browse the repository at this point in the history
  • Loading branch information
datdenkikniet committed May 12, 2024
1 parent 59682aa commit 58880be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/storage/sdr/record/event_only_sensor_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ impl DirectionalSensor for EventOnlySensorRecord {

impl EventOnlySensorRecord {
pub fn parse(record_data: &[u8]) -> Result<Self, ParseError> {
if record_data.len() < 12 {
return Err(ParseError::NotEnoughData);
}

let key = SensorKey::parse(&record_data[..3])?;

let entity_id = record_data[3];
Expand Down

0 comments on commit 58880be

Please sign in to comment.