From 2be78acdd24bb1e9e895837f86b84bc515c42522 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 4 Jan 2014 13:20:57 +0100 Subject: [PATCH] gui/filebrowser: don't segv when removing files with small names Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f953cd07b32effb38b405674c049616c04f457d3 Author: martii Date: 2014-01-04 (Sat, 04 Jan 2014) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index ac519dc5e..2967377c4 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -934,11 +934,10 @@ bool CFileBrowser::exec(const char * const dirname) _msg << " " << g_Locale->getText(LOCALE_FILEBROWSER_DODELETE2); if (ShowMsgUTF(LOCALE_FILEBROWSER_DELETE, _msg.str(), CMessageBox::mbrNo, CMessageBox::mbYes|CMessageBox::mbNo)==CMessageBox::mbrYes) { - recursiveDelete(filelist[selected].Name.c_str()); - if(".ts" ==(filelist[selected].getFileName().substr(filelist[selected].getFileName().length()-3,filelist[selected].getFileName().length())))//if bla.ts - { - recursiveDelete((filelist[selected].Name.substr(0,filelist[selected].Name.length()-7)+".xml").c_str());//remove bla.xml von bla.ts - } + std::string n = filelist[selected].Name; + recursiveDelete(n.c_str()); + if(n.length() > 3 && ".ts" == n.substr(n.length() - 3)) + recursiveDelete((n.substr(0, n.length() - 2) + "xml").c_str()); ChangeDir(Path); }