Ver Fonte

Map server crash fixes
- Fixed two parts of the code that could lead to a map server crash

Playtester há 10 anos atrás
pai
commit
41ec18eae7
2 ficheiros alterados com 8 adições e 3 exclusões
  1. 5 2
      src/map/battle.c
  2. 3 1
      src/map/status.c

+ 5 - 2
src/map/battle.c

@@ -7082,7 +7082,7 @@ struct block_list* battle_get_master(struct block_list *src)
  *
  * Credits:
  *	Original coder unknown
- *	Rewritten by Skoltex
+ *	Rewritten by Skotlex
 */
 int battle_check_target( struct block_list *src, struct block_list *target,int flag)
 {
@@ -7252,7 +7252,10 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 		case BL_SKILL: {
 				struct skill_unit *su = (struct skill_unit *)src;
 
-				if (su && su->group && su->group->src_id == target->id) {
+				if (!su || !su->group)
+					return 0;
+
+				if (su->group->src_id == target->id) {
 					int inf2 = skill_get_inf2(su->group->skill_id);
 					if (inf2&INF2_NO_TARGET_SELF)
 						return -1;

+ 3 - 1
src/map/status.c

@@ -6701,7 +6701,9 @@ int status_get_party_id(struct block_list *bl)
 				return ((TBL_MER*)bl)->master->status.party_id;
 			break;
 		case BL_SKILL:
-			return ((TBL_SKILL*)bl)->group->party_id;
+			if (((TBL_SKILL*)bl)->group)
+				return ((TBL_SKILL*)bl)->group->party_id;
+			break;
 		case BL_ELEM:
 			if (((TBL_ELEM*)bl)->master)
 				return ((TBL_ELEM*)bl)->master->status.party_id;