Fixed class change NPE.
This commit is contained in:
+7
-4
@@ -9627,6 +9627,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)
|
||||
{
|
||||
@@ -9686,10 +9693,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
|
||||
{
|
||||
|
||||
+7
-4
@@ -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
|
||||
{
|
||||
|
||||
+7
-4
@@ -9644,6 +9644,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)
|
||||
{
|
||||
@@ -9703,10 +9710,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
|
||||
{
|
||||
|
||||
+7
-4
@@ -9637,6 +9637,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)
|
||||
{
|
||||
@@ -9696,10 +9703,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
|
||||
{
|
||||
|
||||
+5
-2
@@ -10092,9 +10092,12 @@ public final class L2PcInstance extends L2Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
// Notify to scripts
|
||||
int classId = getSubClasses().get(classIndex).getClassId();
|
||||
// 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);
|
||||
}
|
||||
|
||||
+7
-4
@@ -9569,6 +9569,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)
|
||||
{
|
||||
@@ -9628,10 +9635,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
|
||||
{
|
||||
|
||||
+7
-4
@@ -9569,6 +9569,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)
|
||||
{
|
||||
@@ -9628,10 +9635,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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user