java.lang.NullPointerException
at com.dev.phantomEngine.task.AITask.run(AITask.java:29)
at com.l2jmobius.gameserver.ThreadPoolManager$RunnableWrapper.run(ThreadPoolManager.java:89)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
What can be null here?
code:
package com.dev.phantomEngine.task;
import java.util.List;
import com.dev.phantomEngine.PhantomPlayer;
import com.dev.phantomEngine.PhantomPlayerManager;
public class AITask implements Runnable
{
private final int _from;
private int _to;
public AITask(int from, int to)
{
_from = from;
_to = to;
}
@Override
public void run()
{
adjustPotentialIndexOutOfBounds();
List<PhantomPlayer> fakePlayers = PhantomPlayerManager.INSTANCE.getFakePlayers().subList(_from, _to);
try
{
// fakePlayers.stream().filter(x -> !x.getFakeAi().isBusyThinking()).forEach(x -> x.getFakeAi().thinkAndAct());
for (PhantomPlayer p : fakePlayers)
{
if (!p.getFakeAi().isBusyThinking()) <- Here->
{
p.getFakeAi().thinkAndAct(); <- Here->
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
private void adjustPotentialIndexOutOfBounds()
{
if (_to > PhantomPlayerManager.INSTANCE.getFakePlayersCount())
{
_to = PhantomPlayerManager.INSTANCE.getFakePlayersCount();
}
}
}
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
What's shit here it's whatever's inside your head, desperately trying to twist an answer that's already been given. Thus I upgrade my previous description of you from moron to complete moron. Congratulations.
Question
vRouxy
What can be null here?
code:
print stack trace points to these lines
Edited by vRouxy5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.