summaryrefslogtreecommitdiff
path: root/src/map/chrif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r--src/map/chrif.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index f9a9e7620..ff88945a0 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -312,7 +312,7 @@ int chrif_removemap(int fd){
*/
int chrif_changemapserver(struct map_session_data *sd, short map, int x, int y, int ip, short port)
{
- int /*i, */s_ip=0;
+ int s_ip;
nullpo_retr(-1, sd);
@@ -323,13 +323,11 @@ int chrif_changemapserver(struct map_session_data *sd, short map, int x, int y,
pc_authfail(sd);
return -1;
}
-
- s_ip = 0;
- //for(i = 0; i < fd_max; i++)
- // if (session[i] && session[i]->session_data == sd) {
- s_ip = session[sd->fd]->client_addr.sin_addr.s_addr; // For what you're looping it? [Lance]
- // break;
- // }
+
+ if (sd->fd && sd->fd < fd_max && session[sd->fd])
+ s_ip = session[sd->fd]->client_addr.sin_addr.s_addr;
+ else //Not connected? Can't retrieve IP
+ s_ip = 0;
WFIFOHEAD(char_fd, 35);
WFIFOW(char_fd, 0) = 0x2b05;