mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
try-catch for NPE in purge and fail gracefully if the world is null
Plausible scenario since purge is often run to remove plots in the DB from removed worlds Shouls fix #2806
This commit is contained in:
parent
4ad9f12d5d
commit
afe874a59b
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -192,6 +193,7 @@ public class Purge extends SubCommand {
|
||||
cleared.set(false);
|
||||
Plot plot = iterator.next();
|
||||
if (plot.temp != Integer.MAX_VALUE) {
|
||||
try {
|
||||
ids.add(plot.temp);
|
||||
if (finalClear) {
|
||||
plot.clear(false, true, () -> PlotSquared
|
||||
@ -203,6 +205,14 @@ public class Purge extends SubCommand {
|
||||
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
||||
PlotListener.plotEntry(pp, plot);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
PlotSquared.log(
|
||||
"NullPointer during purge detected. This is likely because you are "
|
||||
+ "deleting a world that has been removed.");
|
||||
if (Settings.DEBUG) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
cleared.set(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user