diff --git a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp index 17e96ea97..45dffa1c4 100644 --- a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp +++ b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp @@ -5,6 +5,8 @@ #include #include #include "../drw_base.h" +#include "../vmisc/vabstractapplication.h" +#include "../ifc/exception/vexception.h" DRW_TextCodec::DRW_TextCodec() : version(DRW::AC1021), @@ -69,6 +71,14 @@ void DRW_TextCodec::setCodePage(const std::string *c, bool dxfFormat){ conv = QTextCodec::codecForName("UTF-16"); } } + + if (conv == nullptr) + { + const QString errorMsg = QCoreApplication::translate("DRW_TextCodec", "No available codec for code page '%1'.") + .arg(cp.c_str()); + qApp->IsPedantic() ? throw VException(errorMsg) : + qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; + } } std::string DRW_TextCodec::toUtf8(const std::string &s) {