diff --git a/src/support/unicode.C b/src/support/unicode.C index 6e814a7b9f..0ddeadffbc 100644 --- a/src/support/unicode.C +++ b/src/support/unicode.C @@ -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 const * tmp = reinterpret_cast(out); return std::vector(tmp, tmp + bytes / sizeof(RetType));