cec-follower/cec-compliance: fix bug in string conversion
PATCH 1/1 cec-follower/cec-compliance: fix bug in string conversion
In all_dev_types2s: don't try to erase the last two characters in the string if it is empty.
This was fixed in cec-ctl, so the same fix is applied to cec-compliance and cec-follower.
Signed-off-by Johan Fjeldtvedt <[email protected]>
--- utils/cec-compliance/cec-compliance.cpp | 4 +++- utils/cec-follower/cec-follower.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
utils/cec-compliance/cec-compliance.cpp +3 -1
@@ -358,7 +358,9 @@ std::string all_dev_types2s(unsigned types) s += "Audio System, "; if (types & CEC_OP_ALL_DEVTYPE_SWITCH) s += "Switch, "; - return s.erase(s.length() - 2, 2); + if (s.length()) + return s.erase(s.length() - 2, 2); + return s; } std::string rc_src_prof2s(unsigned prof)
utils/cec-follower/cec-follower.cpp +3 -1
@@ -305,7 +305,9 @@ std::string all_dev_types2s(unsigned types) s += "Audio System, "; if (types & CEC_OP_ALL_DEVTYPE_SWITCH) s += "Switch, "; - return s.erase(s.length() - 2, 2); + if (s.length()) + return s.erase(s.length() - 2, 2); + return s; } std::string rc_src_prof2s(unsigned prof)
Signature · 1 line
2.7.4