fix(hooks): add defensive null check for matcher.hooks to prevent Windows crash (#441)

This commit is contained in:
YeonGyu-Kim
2026-02-07 13:12:18 +09:00
parent 306da83431
commit 2e0f6bcdf8
7 changed files with 39 additions and 34 deletions
+5 -4
View File
@@ -65,11 +65,12 @@ export async function executeStopHooks(
hook_source: "opencode-plugin",
}
for (const matcher of matchers) {
for (const hook of matcher.hooks) {
if (hook.type !== "command") continue
for (const matcher of matchers) {
if (!matcher.hooks || matcher.hooks.length === 0) continue
for (const hook of matcher.hooks) {
if (hook.type !== "command") continue
if (isHookCommandDisabled("Stop", hook.command, extendedConfig ?? null)) {
if (isHookCommandDisabled("Stop", hook.command, extendedConfig ?? null)) {
log("Stop hook command skipped (disabled by config)", { command: hook.command })
continue
}