Fixed class change NPE.

This commit is contained in:
MobiusDev
2018-04-07 18:10:37 +00:00
parent ecfee7dd5f
commit 4b01a96675
7 changed files with 48 additions and 27 deletions

View File

@@ -10092,9 +10092,12 @@ public final class L2PcInstance extends L2Playable
return false;
}
// Notify to scripts
int classId = getSubClasses().get(classIndex).getClassId();
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
// Notify to scripts before class is removed.
if (!getSubClasses().isEmpty()) // also null check
{
final int classId = getSubClasses().get(classIndex).getClassId();
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
}
getSubClasses().remove(classIndex);
}