./xi_map crash (linux, raspberry pi 4) #5496
-
Hello, I followed the Quick-Start-Guide, I can login, create a character but can't select the character because xi_map crashes.
I'm guessing maybe an encoding problem since there is a weird character there : I saw other also have crashing on xi_maps but on windows so I'm opening a new topic. I know several languages but not c++ so I can't really locate the issue, I checked the encoding of zoneutils.cpp encoding and LF seems ok to me... Any advice ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Try this patch: index 086e117c94..d79574a777 100644
--- a/src/map/lua/luautils.cpp
+++ b/src/map/lua/luautils.cpp
@@ -808,6 +808,20 @@ namespace luautils
std::string filename;
if (PEntity->objtype == TYPE_NPC)
{
+ auto isNamePrintable = [PEntity](std::string name)
+ {
+ if ( std::all_of( name.begin(), name.end(), []( char c ) { return !std::isgraph( c ); } ) )
+ {
+ return false;
+ }
+ return true;
+ };
+
+ if (!isNamePrintable(PEntity->getName()))
+ {
+ return;
+ }
+
std::string zone_name = PEntity->loc.zone->getName();
std::string npc_name = PEntity->getName();
filename = fmt::format("./scripts/zones/{}/npcs/{}.lua", zone_name, npc_name); |
Beta Was this translation helpful? Give feedback.
(this code doesn't work, see #5501 for a real potential patch)