]> git.lyx.org Git - lyx.git/blobdiff - src/support/docstring.cpp
add argument to suppress event processing
[lyx.git] / src / support / docstring.cpp
index 6de9424c1b5822d2d963b4a0e22e3b93d2b5f426..b3417f7f26cd6a889a5e7d73f2a566eae4ccaf7b 100644 (file)
@@ -31,12 +31,13 @@ namespace lyx {
 docstring const from_ascii(char const * ascii)
 {
        docstring s;
-       int n = strlen(ascii);
-       s.resize(n);
-       char_type *d = &s[0];
-       while (--n >= 0) {
-               d[n] = ascii[n];
-               LASSERT(static_cast<unsigned char>(ascii[n]) < 0x80, /**/);
+       if (int n = strlen(ascii)) {
+               s.resize(n);
+               char_type *d = &s[0];
+               while (--n >= 0) {
+                       d[n] = ascii[n];
+                       LASSERT(static_cast<unsigned char>(ascii[n]) < 0x80, /**/);
+               }
        }
        return s;
 }