Allow disabling all alpha optimizations (#181)

Fixes a bug where oxipng would crash if alpha optimizations were all disabled.
This commit is contained in:
Daniel Wong 2019-07-24 04:21:46 +10:00 committed by Josh Holmer
parent 9408a50b1b
commit 4cb26d462e

View file

@ -16,7 +16,10 @@ pub(crate) fn try_alpha_reductions(
alphas: &HashSet<AlphaOptim>,
eval: &Evaluator,
) {
assert!(!alphas.is_empty());
if alphas.is_empty() {
return;
}
let alphas = alphas.iter().collect::<Vec<_>>();
let alphas_iter = alphas.par_iter().with_max_len(1);
alphas_iter