[ML] If snapshot list is empty, return after signaling failure
Original commit: elastic/x-pack-elasticsearch@a89f88da1151ff4c03326e1b559196dba230a5d0
@@ -164,6 +164,7 @@ public class DeleteModelSnapshotAction extends Action<DeleteModelSnapshotAction.
if (deleteCandidates.isEmpty()) {
listener.onFailure(new ResourceNotFoundException(Messages.getMessage(Messages.REST_NO_SUCH_MODEL_SNAPSHOT,
request.getSnapshotId(), request.getJobId())));
+ return;
}
ModelSnapshot deleteCandidate = deleteCandidates.get(0);
