* src/support/unicode.C

(iconv_convert): Fix a crash: Don't try to create a vector from two
	pointers where end is before begin.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16408 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-12-28 07:35:57 +00:00
parent f4540ab1aa
commit 63524a4184

View File

@ -203,6 +203,10 @@ iconv_convert(IconvProcessor & processor,
char * outbuf = out;
int bytes = processor.convert(inbuf, inbytesleft, outbuf, outsize);
if (bytes <= 0)
// Conversion failed
// FIXME Maybe throw an exception and handle that in the caller?
return std::vector<RetType>();
RetType const * tmp = reinterpret_cast<RetType const *>(out);
return std::vector<RetType>(tmp, tmp + bytes / sizeof(RetType));