gui/filebrowser: don't segv when removing files with small names

Origin commit data
------------------
Branch: ni/coolstream
Commit: f953cd07b3
Author: martii <m4rtii@gmx.de>
Date: 2014-01-04 (Sat, 04 Jan 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
martii
2014-01-04 13:20:57 +01:00
committed by vanhofen
parent 67142851c6
commit 2be78acdd2

View File

@@ -934,11 +934,10 @@ bool CFileBrowser::exec(const char * const dirname)
_msg << " " << g_Locale->getText(LOCALE_FILEBROWSER_DODELETE2); _msg << " " << g_Locale->getText(LOCALE_FILEBROWSER_DODELETE2);
if (ShowMsgUTF(LOCALE_FILEBROWSER_DELETE, _msg.str(), CMessageBox::mbrNo, CMessageBox::mbYes|CMessageBox::mbNo)==CMessageBox::mbrYes) if (ShowMsgUTF(LOCALE_FILEBROWSER_DELETE, _msg.str(), CMessageBox::mbrNo, CMessageBox::mbYes|CMessageBox::mbNo)==CMessageBox::mbrYes)
{ {
recursiveDelete(filelist[selected].Name.c_str()); std::string n = filelist[selected].Name;
if(".ts" ==(filelist[selected].getFileName().substr(filelist[selected].getFileName().length()-3,filelist[selected].getFileName().length())))//if bla.ts recursiveDelete(n.c_str());
{ if(n.length() > 3 && ".ts" == n.substr(n.length() - 3))
recursiveDelete((filelist[selected].Name.substr(0,filelist[selected].Name.length()-7)+".xml").c_str());//remove bla.xml von bla.ts recursiveDelete((n.substr(0, n.length() - 2) + "xml").c_str());
}
ChangeDir(Path); ChangeDir(Path);
} }