Prevent NPE for report comments

This commit is contained in:
Hannes Greule 2020-04-21 15:50:47 +02:00 committed by dordsor21
parent caa4a08b26
commit 5bd53436df
3 changed files with 3 additions and 6 deletions

View File

@ -248,10 +248,7 @@ import java.util.concurrent.atomic.AtomicInteger;
return this.notifyTasks; return this.notifyTasks;
} }
public synchronized void addPlotTask(Plot plot, UniqueStatement task) { public synchronized void addPlotTask(@NotNull Plot plot, UniqueStatement task) {
if (plot == null) {
plot = new Plot(null, new PlotId(Integer.MAX_VALUE, Integer.MAX_VALUE));
}
Queue<UniqueStatement> tasks = this.plotTasks.get(plot); Queue<UniqueStatement> tasks = this.plotTasks.get(plot);
if (tasks == null) { if (tasks == null) {
tasks = new ConcurrentLinkedQueue<>(); tasks = new ConcurrentLinkedQueue<>();

View File

@ -204,7 +204,7 @@ public class Plot {
* @param id the plot id * @param id the plot id
* @see Plot#getPlot(Location) for existing plots * @see Plot#getPlot(Location) for existing plots
*/ */
public Plot(PlotArea area, @NotNull PlotId id) { public Plot(@NotNull PlotArea area, @NotNull PlotId id) {
this(area, id, null, 0); this(area, id, null, 0);
} }

View File

@ -35,7 +35,7 @@ import java.util.List;
public class InboxReport extends CommentInbox { public class InboxReport extends CommentInbox {
@Override public boolean getComments(Plot plot, final RunnableVal<List<PlotComment>> whenDone) { @Override public boolean getComments(Plot plot, final RunnableVal<List<PlotComment>> whenDone) {
DBFunc.getComments(null, toString(), new RunnableVal<List<PlotComment>>() { DBFunc.getComments(plot, toString(), new RunnableVal<List<PlotComment>>() {
@Override public void run(List<PlotComment> value) { @Override public void run(List<PlotComment> value) {
whenDone.value = value; whenDone.value = value;
TaskManager.runTask(whenDone); TaskManager.runTask(whenDone);