diff options
author | madmonkey <madfkingmonkey@gmail.com> | 2017-09-29 16:16:20 +0300 |
---|---|---|
committer | madmonkey <madfkingmonkey@gmail.com> | 2017-09-29 16:16:20 +0300 |
commit | d2fc93215a7878708e9892476ad65e727cfe590e (patch) | |
tree | 505d43e6aec7147b277c97f93a88dd60332b711a | |
parent | c8b23088a7fc1b8525f09c29d65642874146ac56 (diff) |
fix crash
-rw-r--r-- | hakchi-gui/src/wincon.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hakchi-gui/src/wincon.cpp b/hakchi-gui/src/wincon.cpp index 9571d72..40adf09 100644 --- a/hakchi-gui/src/wincon.cpp +++ b/hakchi-gui/src/wincon.cpp @@ -48,6 +48,8 @@ CWinCon::CWinCon(QObject*parent):QObject(parent) default: codec=QTextCodec::codecForName("IBM437"); } + if(codec==0) + codec=QTextCodec::codecForLocale(); #else codec=QTextCodec::codecForLocale(); #endif @@ -76,7 +78,10 @@ void CWinCon::readOutput() char buffer[0x1000]; if(fgets(buffer,sizeof(buffer),con)) { - str=codec->toUnicode(buffer); + if(codec) + str=codec->toUnicode(buffer); + else + str=QString::fromLocal8Bit(buffer); if(str.length()) { readOutput(); |