diff --git a/core/AmSipMsg.cpp b/core/AmSipMsg.cpp index 1ac3932d..f1bd4c0f 100644 --- a/core/AmSipMsg.cpp +++ b/core/AmSipMsg.cpp @@ -195,13 +195,16 @@ void removeOptionTag(string& hdrs, const string& hdr_name, const string& tag) { bool found = false; for (std::vector::iterator it=options_v.begin(); it != options_v.end(); it++) { - if (trim(*it, " ")==tag) { + string option = trim(*it, " "); + if (option == tag) { found = true; continue; } - if (it != options_v.begin()) - o_hdr = ", "; - o_hdr+=*it; + if (option.empty()) + continue; + if (!o_hdr.empty()) + o_hdr += ", "; + o_hdr += option; } if (!found) return;