summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-07-28 19:20:03 +0200
committerGitHub <noreply@github.com>2019-07-28 19:20:03 +0200
commit754f7fe5752d3f22bb2a23eb27cbd2f9244533a7 (patch)
tree20bece5bf218b565f5fa97068708e6a2d4623f07
parent8964a0c278390bd87f34cad5ad0ddd5f3d002f06 (diff)
parent2793fa142be02e91f43a831366db232f80940d21 (diff)
downloadhercules-754f7fe5752d3f22bb2a23eb27cbd2f9244533a7.tar.gz
hercules-754f7fe5752d3f22bb2a23eb27cbd2f9244533a7.tar.bz2
hercules-754f7fe5752d3f22bb2a23eb27cbd2f9244533a7.tar.xz
hercules-754f7fe5752d3f22bb2a23eb27cbd2f9244533a7.zip
Merge pull request #2502 from Emistry/family_failsafe_check
Fix family check and EXP bug
-rw-r--r--src/char/char.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c
index cad28b373..c5afc0f63 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -2273,6 +2273,8 @@ static int char_char_married(int pl1, int pl2)
static int char_char_child(int parent_id, int child_id)
{
+ if (parent_id == 0 || child_id == 0) // Failsafe, avoild querys and fix EXP bug dividing with lower level chars
+ return 0;
if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) )
Sql_ShowDebug(inter->sql_handle);
else if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) )
@@ -2292,6 +2294,8 @@ static int char_char_child(int parent_id, int child_id)
static int char_char_family(int cid1, int cid2, int cid3)
{
+ if (cid1 == 0 || cid2 == 0 || cid3 == 0) //Failsafe, and avoid querys where there is no sense to keep executing if any of the inputs are 0
+ return 0;
if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) )
Sql_ShowDebug(inter->sql_handle);
else while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) )