Skip to content

Commit 5b65ade

Browse files
committed
dustmite: Add some assertions
Catch bugs in splitters.
1 parent ee1ec01 commit 5b65ade

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

dustmite.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2633,6 +2633,7 @@ void applyNoRemoveRules(Entity root, RemoveRule[] removeRules)
26332633
return true;
26342634
auto start = s.ptr - f.contents.ptr;
26352635
auto end = start + s.length;
2636+
assert(start <= end && end <= f.contents.length, "String is not a slice of the file");
26362637
return removeChar[start .. end].all;
26372638
}
26382639

@@ -2766,7 +2767,8 @@ void convertRefs(Entity root)
27662767
void convertRef(ref EntityRef r)
27672768
{
27682769
assert(r.entity && !r.address);
2769-
r.address = addresses[r.entity.id];
2770+
r.address = addresses.get(r.entity.id, null);
2771+
assert(r.address, "Dependent not in tree");
27702772
r.entity = null;
27712773
}
27722774

0 commit comments

Comments
 (0)