diff options
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index fb9f85f06e00..22af5001fda7 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -180,7 +180,11 @@ struct test_name_compare bool operator()(const std::string& rCmp) { - size_t nEndPos = maName.find(rCmp) + rCmp.size(); + size_t nPos = maName.find(rCmp); + if (nPos == std::string::npos) + return false; + + size_t nEndPos = nPos + rCmp.size(); return nEndPos == maName.size(); } |