summaryrefslogtreecommitdiff
path: root/src/map/chrif.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-26 11:22:50 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-26 15:04:16 -0700
commit296629e067563e82b4a08b2a785d1c2f13b5a285 (patch)
treecee6131956069aeb6f5430b06a57b1f00750f857 /src/map/chrif.cpp
parent34807ca9fccc7425573256645024722571ef4442 (diff)
downloadtmwa-296629e067563e82b4a08b2a785d1c2f13b5a285.tar.gz
tmwa-296629e067563e82b4a08b2a785d1c2f13b5a285.tar.bz2
tmwa-296629e067563e82b4a08b2a785d1c2f13b5a285.tar.xz
tmwa-296629e067563e82b4a08b2a785d1c2f13b5a285.zip
Add null pointer checks for disconnected internals
Diffstat (limited to 'src/map/chrif.cpp')
-rw-r--r--src/map/chrif.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index ff0adbd..55e5810 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -214,6 +214,9 @@ int chrif_changemapserver(dumb_ptr<map_session_data> sd,
{
nullpo_retr(-1, sd);
+ if (!char_session)
+ return -1;
+
IP4Address s_ip;
for (io::FD i : iter_fds())
{
@@ -395,6 +398,9 @@ int chrif_charselectreq(dumb_ptr<map_session_data> sd)
*/
void chrif_changegm(AccountId id, ZString pass)
{
+ if (!char_session)
+ return;
+
if (battle_config.etc_log)
PRINTF("chrif_changegm: account: %d, password: '%s'.\n"_fmt, id, pass);
@@ -410,6 +416,9 @@ void chrif_changegm(AccountId id, ZString pass)
void chrif_changeemail(AccountId id, AccountEmail actual_email,
AccountEmail new_email)
{
+ if (!char_session)
+ return;
+
if (battle_config.etc_log)
PRINTF("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n"_fmt,
id, actual_email, new_email);
@@ -435,6 +444,9 @@ void chrif_changeemail(AccountId id, AccountEmail actual_email,
void chrif_char_ask_name(AccountId id, CharName character_name, short operation_type,
HumanTimeDiff modif)
{
+ if (!char_session)
+ return;
+
Packet_Fixed<0x2b0e> fixed_0e;
fixed_0e.account_id = id; // who ask, or nobody
fixed_0e.char_name = character_name;
@@ -673,6 +685,9 @@ int chrif_saveaccountreg2(dumb_ptr<map_session_data> sd)
{
nullpo_retr(-1, sd);
+ if (!char_session)
+ return -1;
+
std::vector<Packet_Repeat<0x2b10>> repeat_10;
for (size_t j = 0; j < sd->status.account_reg2_num; j++)
{
@@ -905,6 +920,9 @@ int chrif_recvgmaccounts(Session *s, const std::vector<Packet_Repeat<0x2b15>>& r
*/
int chrif_reloadGMdb(void)
{
+ if (!char_session)
+ return -1;
+
Packet_Fixed<0x2af7> fixed_f7;
send_fpacket<0x2af7, 2>(char_session, fixed_f7);