summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-12-06 16:43:59 +0100
committerHaru <haru@dotalux.com>2013-12-06 17:21:03 +0100
commit1f1930c0e3d2bb928d9fc9a39f360815daf77e8f (patch)
tree8f05ad76e514abac3b347dc9214603a9d7731711 /src/map/intif.c
parent2175dbec8fd4c0e691b2d3ad83e2dd78e834b8a8 (diff)
downloadhercules-1f1930c0e3d2bb928d9fc9a39f360815daf77e8f.tar.gz
hercules-1f1930c0e3d2bb928d9fc9a39f360815daf77e8f.tar.bz2
hercules-1f1930c0e3d2bb928d9fc9a39f360815daf77e8f.tar.xz
hercules-1f1930c0e3d2bb928d9fc9a39f360815daf77e8f.zip
Corrected some potential issues in the questlog system
- Should fixe bugreport:7888, thanks to rosfus http://hercules.ws/board/tracker/issue-7888-some-issue-crush-my-mapserver - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index 8fdc8e3a3..3779eaa21 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1337,12 +1337,13 @@ void intif_parse_QuestLog(int fd) {
if (!sd) // User not online anymore
return;
+ sd->num_quests = sd->avail_quests = 0;
+
if (num_received == 0) {
if (sd->quest_log) {
aFree(sd->quest_log);
sd->quest_log = NULL;
}
- sd->num_quests = sd->avail_quests = 0;
} else {
struct quest *received = (struct quest *)RFIFOP(fd, 8);
int i, k = num_received;
@@ -1357,7 +1358,7 @@ void intif_parse_QuestLog(int fd) {
ShowError("intif_parse_QuestLog: quest %d not found in DB.\n", received[i].quest_id);
continue;
}
- if (received->state != Q_COMPLETE) {
+ if (received[i].state != Q_COMPLETE) {
// Insert at the beginning
memcpy(&sd->quest_log[sd->avail_quests++], &received[i], sizeof(struct quest));
} else {