summaryrefslogtreecommitdiffhomepage
path: root/internal/llm/tools
diff options
context:
space:
mode:
authorFuad <[email protected]>2025-04-26 23:00:50 +0300
committerKujtim Hoxha <[email protected]>2025-04-27 13:46:59 +0200
commit94aeb7b7fe86b2969c5ff99d88ede7071025d770 (patch)
tree526e9e6830218358c25c94eb1352dd9e6e127d09 /internal/llm/tools
parenta35466cdb33c7257ec275044d6ef2472c6419fee (diff)
downloadopencode-94aeb7b7fe86b2969c5ff99d88ede7071025d770.tar.gz
opencode-94aeb7b7fe86b2969c5ff99d88ede7071025d770.zip
Fix nil pointer dereference in GetPersistentShell
Added nil check in GetPersistentShell before accessing shellInstance.isAlive to prevent panic when newPersistentShell returns nil due to shell startup errors. This resolves the "invalid memory address or nil pointer dereference" error that was occurring in the shell tool.
Diffstat (limited to 'internal/llm/tools')
-rw-r--r--internal/llm/tools/shell/shell.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/llm/tools/shell/shell.go b/internal/llm/tools/shell/shell.go
index e25bdf3ea..08d8a986b 100644
--- a/internal/llm/tools/shell/shell.go
+++ b/internal/llm/tools/shell/shell.go
@@ -47,7 +47,7 @@ func GetPersistentShell(workingDir string) *PersistentShell {
shellInstance = newPersistentShell(workingDir)
})
- if !shellInstance.isAlive {
+ if shellInstance == nil || !shellInstance.isAlive {
shellInstance = newPersistentShell(shellInstance.cwd)
}