From de5880169b1eb14a7e2dd57f42916e61f53832ba Mon Sep 17 00:00:00 2001 From: Matthew Wang Date: Mon, 23 Oct 2023 01:14:01 -0700 Subject: [PATCH] Add check to see if scratch is valid/fix bug --- src/builder/bdd/robdd.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/builder/bdd/robdd.rs b/src/builder/bdd/robdd.rs index a95ec6fd..ea4e6255 100644 --- a/src/builder/bdd/robdd.rs +++ b/src/builder/bdd/robdd.rs @@ -190,10 +190,12 @@ impl<'a, T: IteTable<'a, BddPtr<'a>> + Default> RobddBuilder<'a, T> { match bdd.scratch::() { None => (), Some(v) => { - return if bdd.is_neg() { - alloc[v].neg() - } else { - alloc[v] + if alloc.len() > v { + return if bdd.is_neg() { + alloc[v].neg() + } else { + alloc[v] + }; } } };