Skip to content

Commit 733fea2

Browse files
committed
Improve validation of hitCondition
1 parent 84f0623 commit 733fea2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/debug/debugSession.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,12 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
323323
await Promise.all(
324324
xdebugBreakpoints.map(async (breakpoint, index) => {
325325
try {
326-
if (breakpoint.hitCondition && !/^\d+$/.test(breakpoint.hitCondition)) {
327-
// The user-defined hitCondition wasn't an integer
326+
if (breakpoint.hitCondition && !/^[1-9]\d*$/.test(breakpoint.hitCondition)) {
327+
// The user-defined hitCondition wasn't a positive integer
328328
vscodeBreakpoints[index] = {
329329
verified: false,
330330
line: breakpoint.line,
331-
message: "Hit Count must be an integer",
331+
message: "Hit Count must be a positive integer",
332332
};
333333
} else {
334334
await this._connection.sendBreakpointSetCommand(breakpoint);

src/debug/xdebugConnection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export abstract class Breakpoint {
159159
this.state = breakpointNode.getAttribute("state") as BreakpointState;
160160
} else {
161161
this.type = rest[0];
162-
this.hitCondition = rest[1];
162+
this.hitCondition = rest[1].trim();
163163
this.state = "enabled";
164164
}
165165
}

0 commit comments

Comments
 (0)