Fixes a crash caused by invalid skill ID (#4935)
* Fixes #4934. * Fixes a potential crash when using atcommand useskill. Thanks to @Stingor and @CairoLee!
This commit is contained in:
@@ -1558,6 +1558,9 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
||||
int inf = skill_get_inf(skill_id);
|
||||
std::shared_ptr<s_skill_db> skill = skill_db.find(skill_id);
|
||||
|
||||
if (!skill)
|
||||
return 0;
|
||||
|
||||
// temp: used to signal combo-skills right now.
|
||||
if (sc && sc->data[SC_COMBO] &&
|
||||
skill_is_combo(skill_id) &&
|
||||
@@ -2035,6 +2038,9 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
||||
if (sc && !sc->count)
|
||||
sc = NULL;
|
||||
|
||||
if (!skill_db.find(skill_id))
|
||||
return 0;
|
||||
|
||||
if( sd ) {
|
||||
if( skill_isNotOk(skill_id, sd) || !skill_check_condition_castbegin(sd, skill_id, skill_lv) )
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user