Skip to content

Commit 9350f3b

Browse files
committed
fix: NPE fix
1 parent 3d6ab67 commit 9350f3b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/move/decorator/FilteringMoveSelector.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public JustInTimeFilteringMoveIterator(Iterator<Move<Solution_>> childMoveIterat
8787
this.childMoveIterator = childMoveIterator;
8888
this.bailOutSize = bailOutSize;
8989
this.phaseScope = phaseScope;
90-
this.termination = phaseScope.getTermination();
90+
this.termination = phaseScope != null ? phaseScope.getTermination() : null;
9191
}
9292

9393
@Override
@@ -141,12 +141,11 @@ private long determineBailOutSize() {
141141
}
142142

143143
private boolean accept(ScoreDirector<Solution_> scoreDirector, Move<Solution_> move) {
144-
if (filter != null) {
145-
if (!filter.accept(scoreDirector, move)) {
146-
logger.trace(" Move ({}) filtered out by a selection filter ({}).", move, filter);
147-
return false;
148-
}
144+
if (filter != null && !filter.accept(scoreDirector, move)) {
145+
logger.trace(" Move ({}) filtered out by a selection filter ({}).", move, filter);
146+
return false;
149147
}
148+
150149
return true;
151150
}
152151

0 commit comments

Comments
 (0)