aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-09-01 09:23:39 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-09-01 09:23:39 +0300
commitf60227f112a36d943c83d4d1ac0b24754fbd537e (patch)
tree9cb8945c0e98a365e7b303fe037b199652ebe926 /src
parentf3630e95d6eb4f51e57cec7705764b788572e9ec (diff)
downloadminetest-f60227f112a36d943c83d4d1ac0b24754fbd537e.tar.gz
minetest-f60227f112a36d943c83d4d1ac0b24754fbd537e.tar.bz2
minetest-f60227f112a36d943c83d4d1ac0b24754fbd537e.zip
Don't crash in "unexpected multibyte character"; just print it in log. Github #222
Diffstat (limited to 'src')
-rw-r--r--src/keycode.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/keycode.cpp b/src/keycode.cpp
index df3ebc9e3..5a8df0db4 100644
--- a/src/keycode.cpp
+++ b/src/keycode.cpp
@@ -21,6 +21,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "main.h" // For g_settings
#include "exceptions.h"
#include "settings.h"
+#include "log.h"
+#include "hex.h"
class UnknownKeycode : public BaseException
{
@@ -295,7 +297,10 @@ KeyPress::KeyPress(const irr::SEvent::SKeyInput &in)
} else {
m_name.resize(MB_CUR_MAX+1, '\0');
int written = wctomb(&m_name[0], Char);
- assert (written >= 0 && "unexpected multibyte character");
+ if(written >= 0){
+ std::string hexstr = hex_encode((const char*)&Char, sizeof(Char));
+ errorstream<<"KeyPress: Unexpected multibyte character "<<hexstr<<std::endl;
+ }
}
}