diff --git a/ts2panda/src/debuginfo.ts b/ts2panda/src/debuginfo.ts index b49a58105a3a0e58a2819681e6984fdf8fd01110..7e95232598f43762bf4c96f32041774cf20cba93 100644 --- a/ts2panda/src/debuginfo.ts +++ b/ts2panda/src/debuginfo.ts @@ -309,13 +309,17 @@ export class DebugInfo { ( insns[i]).getScope().setScopeStartInsIdx(i); // delete ins placeholder insns.splice(i, 1); - i--; + if (i > 0) { + i--; + } } if (insns[i] instanceof DebugInsEndPlaceHolder) { - ( insns[i]).getScope().setScopeEndInsIdx(i); + ( insns[i]).getScope().setScopeEndInsIdx(i > 0 ? i - 1 : 0); // delete ins placeholder insns.splice(i, 1); - i--; + if (i > 0) { + i--; + } } }