From 427e405be2396d318ddf59c83dc037851f6ee607 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Fri, 13 Sep 2013 18:10:42 +0100 Subject: [PATCH] Fixed potential crashes when reading previous report. --- src/gui/main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 8ada920f..b29c25bb 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -749,11 +749,15 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { //Slim down to only the details section. size_t pos1 = oldDetails.find("
", pos1); - size_t pos2 = oldDetails.find("
", pos1); - pos2 = oldDetails.rfind("", pos2) - 3; //Remove the 3 tabs preceding the closing tag. + if (pos1 != string::npos) { + pos1 = oldDetails.find("", pos2) - 3; //Remove the 3 tabs preceding the closing tag. - oldDetails = oldDetails.substr(pos1, pos2 - pos1); + oldDetails = oldDetails.substr(pos1, pos2 - pos1); + } + } boost::replace_all(oldDetails, "\t\t\t\t", "\t"); oldDetails += "\n"; }