diff --git a/src/Defines.cpp b/src/Defines.cpp index e6aac21..e0ce9ce 100644 --- a/src/Defines.cpp +++ b/src/Defines.cpp @@ -204,13 +204,13 @@ std::string Defines::p2str(int type, int val) { switch (type) { case CL2LS: val = val - CL2LS - 1; - if (val > N_CL2LS) + if (val > N_CL2LS || val < 0) break; return cl2ls_map[val].name; case CL2FE: val = val - CL2FE - 1; - if (val > N_CL2FE) + if (val > N_CL2FE || val < 0) break; return cl2fe_map[val].name; diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index ef4b79e..9988f1d 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -106,9 +106,9 @@ void NPCManager::updatePlayerNPCS(CNSocket* sock, PlayerView& view) { // remove from view view.viewableNPCs.erase(i++); + } else { + i++; } - - ++i; } INITSTRUCT(sP_FE2CL_NPC_ENTER, enterData);