forked from Mirrorlandia_minetest/minetest
Don't crash in "unexpected multibyte character"; just print it in log. Github #222
This commit is contained in:
parent
f3630e95d6
commit
f60227f112
@ -21,6 +21,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "main.h" // For g_settings
|
#include "main.h" // For g_settings
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "hex.h"
|
||||||
|
|
||||||
class UnknownKeycode : public BaseException
|
class UnknownKeycode : public BaseException
|
||||||
{
|
{
|
||||||
@ -295,7 +297,10 @@ KeyPress::KeyPress(const irr::SEvent::SKeyInput &in)
|
|||||||
} else {
|
} else {
|
||||||
m_name.resize(MB_CUR_MAX+1, '\0');
|
m_name.resize(MB_CUR_MAX+1, '\0');
|
||||||
int written = wctomb(&m_name[0], Char);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user