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

@ -9634,6 +9634,13 @@ public final class L2PcInstance extends L2Playable
try
{
// 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);
}
final SubClass subClass = getSubClasses().remove(classIndex);
if (subClass == null)
{
@ -9693,10 +9700,6 @@ public final class L2PcInstance extends L2Playable
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
return false;
}
// Notify to scripts
int classId = getSubClasses().get(classIndex).getClassId();
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
}
finally
{