]> git.lyx.org Git - lyx.git/blobdiff - src/support/environment.cpp
Fix assertion when checking if change in selection
[lyx.git] / src / support / environment.cpp
index 091fa278c015cfa4bc204f2d3b8d2271151a3fcc..e39fd3449ebcf6a5a326cf776b0794db0330ab1f 100644 (file)
@@ -57,7 +57,13 @@ bool setEnv(string const & name, string const & value)
        // CHECK Look at and fix this.
        // f.ex. what about error checking?
 
-       string const encoded = to_local8bit(from_utf8(value));
+       string encoded;
+       try {
+               encoded = to_local8bit(from_utf8(value));
+       } catch (...) {
+               return false;
+       }
+
 #if defined (HAVE_SETENV)
        return ::setenv(name.c_str(), encoded.c_str(), 1) == 0;
 #elif defined (HAVE_PUTENV)