File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Core/src/main/java/com/plotsquared/core/util/query Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -35,16 +35,19 @@ interface PlotProvider {
3535 Stream <Plot > streamPlots ();
3636
3737 default Stream <Plot > streamPlotsInPlotAreas (PlotArea [] areas ) {
38+ if (areas == null || areas .length == 0 ) {
39+ return Stream .of ();
40+ }
3841 return StreamSupport .stream (Spliterators .spliteratorUnknownSize (new Iterator <>() {
3942 private int areaIndex = -1 ;
4043 private Iterator <Plot > currentAreaPlots ;
4144 @ Override
4245 public boolean hasNext () {
43- if (currentAreaPlots == null ) {
44- return areas .length > 0 ;
45- }
46- if (! currentAreaPlots . hasNext ()) {
47- return ++areaIndex < areas . length - 1 ;
46+ if (currentAreaPlots == null || ! currentAreaPlots . hasNext () ) {
47+ if ( areaIndex >= areas .length ) {
48+ return false ;
49+ }
50+ currentAreaPlots = areas [ ++areaIndex ]. getPlots (). iterator () ;
4851 }
4952 return true ;
5053 }
You can’t perform that action at this time.
0 commit comments