diff --git a/Common/onelab.h b/Common/onelab.h
index 32ed1533606dcb71cbd144f5a5a22a87849fcb4f..275613eb84f26e65357ee6dbf628b33b7e5d8bc1 100644
--- a/Common/onelab.h
+++ b/Common/onelab.h
@@ -110,6 +110,7 @@ namespace onelab{
     static std::string getNextToken(const std::string &msg, 
                                     std::string::size_type &first)
     {
+      if(first == std::string::npos) return "";
       std::string::size_type last = msg.find_first_of(charSep(), first);
       std::string next = msg.substr(first, last - first);
       first = (last == std::string::npos) ? last : last + 1;