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 <jaffe1@xxxxxxxxx> --- utils/cec-compliance/cec-compliance.cpp | 4 +++- utils/cec-follower/cec-follower.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index c40d4b1..519c572 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -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) diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index abb06a8..7850ecd 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -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) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html