diff --git a/src/permutate.hpp b/src/permutate.hpp index 2b83d02f5..01077940c 100644 --- a/src/permutate.hpp +++ b/src/permutate.hpp @@ -22,14 +22,18 @@ namespace Sass { const std::vector>& in) { - size_t L = in.size(); - size_t n = 0; + size_t L = in.size(), n = 0; + + // Exit early if any entry is empty + for (size_t i = 0; i < L; i += 1) { + if (in[i].size() == 0) return {}; + } + size_t* state = new size_t[L + 1]; std::vector> out; // First initialize all states for every permutation group for (size_t i = 0; i < L; i += 1) { - if (in[i].size() == 0) return {}; state[i] = in[i].size() - 1; } while (true) {