Fixed possible L2NpcActionShift NPE.

This commit is contained in:
MobiusDev 2017-09-12 18:00:59 +00:00
parent 1d4295ece8
commit 9e8cdc27b4
4 changed files with 4 additions and 4 deletions

View File

@ -115,7 +115,7 @@ public class L2NpcActionShift implements IActionShiftHandler
{
final String fileName = template.getSpawnTemplate().getFile().getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/');
html.replace("%spawnfile%", fileName);
html.replace("%spawnname%", template.getSpawnTemplate().getName());
html.replace("%spawnname%", String.valueOf(template.getSpawnTemplate().getName())); // used String.valueOf because it can be null
html.replace("%spawngroup%", String.valueOf(template.getGroup().getName())); // used String.valueOf because it can be null
if (template.getSpawnTemplate().getAI() != null)
{

View File

@ -115,7 +115,7 @@ public class L2NpcActionShift implements IActionShiftHandler
{
final String fileName = template.getSpawnTemplate().getFile().getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/');
html.replace("%spawnfile%", fileName);
html.replace("%spawnname%", template.getSpawnTemplate().getName());
html.replace("%spawnname%", String.valueOf(template.getSpawnTemplate().getName())); // used String.valueOf because it can be null
html.replace("%spawngroup%", String.valueOf(template.getGroup().getName())); // used String.valueOf because it can be null
if (template.getSpawnTemplate().getAI() != null)
{

View File

@ -115,7 +115,7 @@ public class L2NpcActionShift implements IActionShiftHandler
{
final String fileName = template.getSpawnTemplate().getFile().getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/');
html.replace("%spawnfile%", fileName);
html.replace("%spawnname%", template.getSpawnTemplate().getName());
html.replace("%spawnname%", String.valueOf(template.getSpawnTemplate().getName())); // used String.valueOf because it can be null
html.replace("%spawngroup%", String.valueOf(template.getGroup().getName())); // used String.valueOf because it can be null
if (template.getSpawnTemplate().getAI() != null)
{

View File

@ -115,7 +115,7 @@ public class L2NpcActionShift implements IActionShiftHandler
{
final String fileName = template.getSpawnTemplate().getFile().getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/');
html.replace("%spawnfile%", fileName);
html.replace("%spawnname%", template.getSpawnTemplate().getName());
html.replace("%spawnname%", String.valueOf(template.getSpawnTemplate().getName())); // used String.valueOf because it can be null
html.replace("%spawngroup%", String.valueOf(template.getGroup().getName())); // used String.valueOf because it can be null
if (template.getSpawnTemplate().getAI() != null)
{