From aef1b694e80d297d95db478977ea901fe3966b79 Mon Sep 17 00:00:00 2001 From: Nicky Date: Tue, 26 Nov 2013 21:05:56 +0100 Subject: [PATCH] Check for proper index before using it as string subscript. --- indra/newview/lggcontactsets.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/indra/newview/lggcontactsets.cpp b/indra/newview/lggcontactsets.cpp index 122d94c5ed..17a8777b22 100644 --- a/indra/newview/lggcontactsets.cpp +++ b/indra/newview/lggcontactsets.cpp @@ -91,7 +91,14 @@ std::string LGGContactSets::getOldFileName() std::string normalPath=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, ""); //we want to steal the last directory off this one - std::string userNameDir = normalPath.substr(normalPath.find_last_of(gDirUtilp->getDirDelimiter())); + + std::string userNameDir; + + if( normalPath.size() && std::string::npos != normalPath.find_last_of( gDirUtilp->getDirDelimiter() ) ) + userNameDir = normalPath.substr(normalPath.find_last_of(gDirUtilp->getDirDelimiter())); + else + userNameDir = normalPath; + path += userNameDir; if (!path.empty())