X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FEventOperation.cpp;h=f21f729b8b6870cf5fdafea024b60bba9881b179;hp=4d80410f542953b23c02be25899777b16cf91a03;hb=82cfe5ba5f0ff723b7b024b526ddce8b3e1a92d4;hpb=3df6432f30bd5316c35e66ee2da8a9760a8e15f3
diff --git a/example/diameter/launcher/EventOperation.cpp b/example/diameter/launcher/EventOperation.cpp
index 4d80410..f21f729 100644
--- a/example/diameter/launcher/EventOperation.cpp
+++ b/example/diameter/launcher/EventOperation.cpp
@@ -754,18 +754,22 @@ bool EventOperation::test_id__waitfefc_msg(std::string &response, unsigned int i
std::string::size_type pos, pos_1, pos_2;
pos = regexp.find("end-to-end-id=", 0u);
- pos = regexp.find("\"", pos);
- pos_1 = pos;
- pos = regexp.find("\"", pos+1);
- pos_2 = pos;
- regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+ if (pos != std::string::npos) {
+ pos = regexp.find("\"", pos);
+ pos_1 = pos;
+ pos = regexp.find("\"", pos+1);
+ pos_2 = pos;
+ regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+ }
pos = regexp.find("hop-by-hop-id=", 0u);
- pos = regexp.find("\"", pos);
- pos_1 = pos;
- pos = regexp.find("\"", pos+1);
- pos_2 = pos;
- regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+ if (pos != std::string::npos) {
+ pos = regexp.find("\"", pos);
+ pos_1 = pos;
+ pos = regexp.find("\"", pos+1);
+ pos_2 = pos;
+ regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+ }
// For this representation:
//pos = regexp.find("Origin-State-Id", 0u);
@@ -777,13 +781,15 @@ bool EventOperation::test_id__waitfefc_msg(std::string &response, unsigned int i
//regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
// But we have this one:
pos = regexp.find("Origin-State-Id", 0u);
- pos = regexp.rfind("\"", pos);
- pos = regexp.rfind("\"", pos-1);
- pos = regexp.rfind("\"", pos-1);
- pos_1 = pos;
- pos = regexp.find("\"", pos+1);
- pos_2 = pos;
- regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+ if (pos != std::string::npos) {
+ pos = regexp.rfind("\"", pos);
+ pos = regexp.rfind("\"", pos-1);
+ pos = regexp.rfind("\"", pos-1);
+ pos_1 = pos;
+ pos = regexp.find("\"", pos+1);
+ pos_2 = pos;
+ regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+ }
//regexp.insert(0, "^");
//regexp += "$";