fix dumb typo bug in signal/state input validation

The effect was that it'd allow any state for signal 0, when it should
have allowed state 0 for any signal.
This commit is contained in:
Scott Lamb 2019-06-14 16:41:18 -07:00
parent 1312349ca1
commit d8b8d5d5e0

View File

@ -290,7 +290,7 @@ impl State {
let states = self.types_by_uuid.get(&s.type_)
.map(|t| &t.states)
.unwrap_or(&empty);
if signal != 0 && states.binary_search_by_key(&state, |s| s.value).is_err() {
if state != 0 && states.binary_search_by_key(&state, |s| s.value).is_err() {
bail_t!(FailedPrecondition, "signal {} specifies unknown state {}",
signal, state);
}