Fixes a crash with script command sc_end (#6659)
* Fixes #6657. * Adds an extra sanity check. * Moves the database check post the sanity checks for faster processing. Thanks to @kaninhot004!
This commit is contained in:
parent
0ca5f450b7
commit
0f4f612878
@ -12001,14 +12001,17 @@ BUILDIN_FUNC(sc_end)
|
||||
if (type >= SC_NONE && type < SC_MAX) {
|
||||
struct status_change *sc = status_get_sc(bl);
|
||||
|
||||
if (!sc)
|
||||
if (sc == nullptr)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
||||
struct status_change_entry *sce = sc->data[type];
|
||||
|
||||
if (sce == nullptr)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
||||
if (status_db.hasSCF(sc, SCF_NOCLEARBUFF))
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
||||
struct status_change_entry *sce = sc ? sc->data[type] : NULL;
|
||||
|
||||
//This should help status_change_end force disabling the SC in case it has no limit.
|
||||
sce->val1 = sce->val2 = sce->val3 = sce->val4 = 0;
|
||||
status_change_end(bl, (sc_type)type, INVALID_TIMER);
|
||||
|
Loading…
x
Reference in New Issue
Block a user