Read 0 or 1 values as valid booleans
This commit is contained in:
parent
9d0ee6969c
commit
ab3715f7a9
1 changed files with 4 additions and 2 deletions
|
|
@ -211,9 +211,11 @@ absl::optional<ValueType> readOpcode(absl::string_view value, const Range<ValueT
|
||||||
absl::optional<bool> readBooleanFromOpcode(const Opcode& opcode)
|
absl::optional<bool> readBooleanFromOpcode(const Opcode& opcode)
|
||||||
{
|
{
|
||||||
switch (hash(opcode.value)) {
|
switch (hash(opcode.value)) {
|
||||||
case hash("off"):
|
case hash("off"): // fallthrough
|
||||||
|
case hash("0"):
|
||||||
return false;
|
return false;
|
||||||
case hash("on"):
|
case hash("on"): // fallthrough
|
||||||
|
case hash("1"):
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue