]> git.lyx.org Git - features.git/commitdiff
add some sanity checks.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 18 Oct 2006 12:06:04 +0000 (12:06 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 18 Oct 2006 12:06:04 +0000 (12:06 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15362 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/unicode.C

index 1545e2ddc01b19e0bf9609ec751c9d208e8b6b8c..8779aeee8d1b9507cbe2a60db3e27add1169bc84 100644 (file)
@@ -127,6 +127,9 @@ iconv_convert(iconv_t * cd,
 
 std::vector<lyx::char_type> utf8_to_ucs4(std::vector<char> const & utf8str)
 {
+       if (utf8str.empty())
+               return std::vector<lyx::char_type>();
+
        return utf8_to_ucs4(&utf8str[0], utf8str.size());
 }
 
@@ -150,6 +153,9 @@ ucs2_to_ucs4(unsigned short c)
 std::vector<lyx::char_type>
 ucs2_to_ucs4(std::vector<unsigned short> const & ucs2str)
 {
+       if (ucs2str.empty())
+               return std::vector<lyx::char_type>();
+
        return ucs2_to_ucs4(&ucs2str[0], ucs2str.size());
 }
 
@@ -173,6 +179,9 @@ ucs4_to_ucs2(lyx::char_type c)
 std::vector<unsigned short>
 ucs4_to_ucs2(std::vector<lyx::char_type> const & ucs4str)
 {
+       if (ucs4str.empty())
+               return std::vector<unsigned short>();
+
        return ucs4_to_ucs2(&ucs4str[0], ucs4str.size());
 }
 
@@ -197,6 +206,9 @@ ucs4_to_utf8(lyx::char_type c)
 std::vector<char>
 ucs4_to_utf8(std::vector<lyx::char_type> const & ucs4str)
 {
+       if (ucs4str.empty())
+               return std::vector<char>();
+
        return ucs4_to_utf8(&ucs4str[0], ucs4str.size());
 }