]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/frontend_helpers.cpp
* src/frontend/controllers/frontend_helpers.cpp: safety fix suggested by Andre
[lyx.git] / src / frontends / controllers / frontend_helpers.cpp
index bf0df1d9337c22cc8b42e8ee20d35e7145b18b62..87e2936f640d27680940a95cdc72eb6b5188f49a 100644 (file)
 
 #include "Buffer.h"
 #include "BufferParams.h"
+#include "Color.h"
 #include "debug.h"
 #include "gettext.h"
 #include "Language.h"
 #include "Length.h"
 
-#include <boost/regex.hpp>
-
-#include <algorithm>
-#include <config.h>
-
-#include "Color.h"
-
 #include "frontends/FileDialog.h"
 #include "frontends/alert.h"
+
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/Package.h"
 #include "support/Systemcall.h"
 
 #include <boost/cregex.hpp>
+#include <boost/regex.hpp>
+
+#include <algorithm>
 #include <fstream>
+#include <locale>
+
 using std::string;
 using std::vector;
 using std::pair;
@@ -191,7 +191,7 @@ docstring const familyName(docstring const & name)
        if (idx != docstring::npos)
                return ltrim(fname.substr(0, idx));
        idx = fname.rfind('.');
-       if (idx != docstring::npos)
+       if (idx != docstring::npos && idx + 1 < fname.size())
                fname = ltrim(fname.substr(idx + 1));
        // test if we have a LaTeX Space in front
        if (fname[0] == '\\')
@@ -1108,10 +1108,13 @@ class Sorter
                                      LanguagePair, bool>
 {
 public:
+       Sorter() : loc_("") {};
        bool operator()(LanguagePair const & lhs,
                        LanguagePair const & rhs) const {
-               return lhs.first < rhs.first;
+               return loc_(lhs.first, rhs.first);
        }
+private:
+       std::locale loc_;
 };
 
 } // namespace anon