summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-04-26 09:29:29 +0000
committerOmar Rizwan <omar@omar.website>2023-04-26 09:29:29 +0000
commit9d91b31377c1c8a63a0babefd10f79b1a2deb974 (patch)
treece0d60ba3b252148789f707bf773a8ce9f168d3f /lib
parentFix Commit on laptop window close (diff)
downloadfolk-9d91b31377c1c8a63a0babefd10f79b1a2deb974.tar.gz
folk-9d91b31377c1c8a63a0babefd10f79b1a2deb974.zip
Fix id=0 bug in Unmatch
Diffstat (limited to 'lib')
-rw-r--r--lib/evaluator.tcl18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/evaluator.tcl b/lib/evaluator.tcl
index 2e4c2e30..d41b9e94 100644
--- a/lib/evaluator.tcl
+++ b/lib/evaluator.tcl
@@ -949,18 +949,16 @@ namespace eval Evaluator {
for (int i = 0; i < level; i++) {
match_t* unmatch = matchGet(unmatchId);
// Get first parent of unmatchId (should be the When)
- statement_handle_t unmatchWhenId = {0};
for (int j = 0; j < unmatch->n_edges; j++) {
if (unmatch->edges[j].type == PARENT) {
- unmatchWhenId = unmatch->edges[j].statement;
- break;
- }
- }
- if (unmatchWhenId.idx == 0) { exit(3); }
- statement_t* unmatchWhen = get(unmatchWhenId);
- for (int j = 0; j < unmatchWhen->n_edges; j++) {
- if (unmatchWhen->edges[j].type == PARENT) {
- unmatchId = unmatchWhen->edges[j].match;
+ statement_handle_t unmatchWhenId = unmatch->edges[j].statement;
+ statement_t* unmatchWhen = get(unmatchWhenId);
+ for (int k = 0; k < unmatchWhen->n_edges; k++) {
+ if (unmatchWhen->edges[k].type == PARENT) {
+ unmatchId = unmatchWhen->edges[k].match;
+ break;
+ }
+ }
break;
}
}