From 4cb26d462ee6b76c373d2921dbedd5446eed61b2 Mon Sep 17 00:00:00 2001 From: Daniel Wong Date: Wed, 24 Jul 2019 04:21:46 +1000 Subject: [PATCH] Allow disabling all alpha optimizations (#181) Fixes a bug where oxipng would crash if alpha optimizations were all disabled. --- src/reduction/alpha.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/reduction/alpha.rs b/src/reduction/alpha.rs index b255e9f7..a13a9056 100644 --- a/src/reduction/alpha.rs +++ b/src/reduction/alpha.rs @@ -16,7 +16,10 @@ pub(crate) fn try_alpha_reductions( alphas: &HashSet, eval: &Evaluator, ) { - assert!(!alphas.is_empty()); + if alphas.is_empty() { + return; + } + let alphas = alphas.iter().collect::>(); let alphas_iter = alphas.par_iter().with_max_len(1); alphas_iter