We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cfb7ddd + 3be1c45 commit c0e7189Copy full SHA for c0e7189
src/changes/ReferenceTracker.ts
@@ -27,8 +27,18 @@ export class ReferenceTracker {
27
}
28
29
// for decoding
30
- removeRef(refId) {
31
- this.refCounts[refId] = this.refCounts[refId] - 1;
+ removeRef(refId: number) {
+ const refCount = this.refCounts[refId];
32
+ if (refCount === undefined) {
33
+ console.warn(`trying to remove reference ${refId} that doesn't exist`);
34
+ return;
35
+ }
36
+ if (refCount === 0) {
37
+ console.warn(`trying to remove reference ${refId} with 0 refCount`);
38
39
40
+
41
+ this.refCounts[refId] = refCount - 1;
42
this.deletedRefs.add(refId);
43
44
0 commit comments