X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3660dcb2f3b7fe836bebaee720332b4ea50a35b..df1f4832e5e08438255594172b4c2b31b34f6453:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index c33c44c174..0a2241edd8 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -361,17 +361,16 @@ void wxStripExtension(wxChar *buffer) void wxStripExtension(wxString& buffer) { - size_t len = buffer.Length(); - size_t i = len-1; - while (i > 0) - { - if (buffer.GetChar(i) == wxT('.')) + //RN: Be careful about the handling the case where + //buffer.Length() == 0 + for(size_t i = buffer.Length() - 1; i != wxString::npos; --i) { - buffer = buffer.Left(i); - break; + if (buffer.GetChar(i) == wxT('.')) + { + buffer = buffer.Left(i); + break; + } } - i --; - } } // Destructive removal of /./ and /../ stuff