mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-13 11:39:41 +03:00
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.
This commit is contained in:
committed by
Kujtim Hoxha
Unverified
parent
a35466cdb3
commit
94aeb7b7fe
@@ -47,7 +47,7 @@ func GetPersistentShell(workingDir string) *PersistentShell {
|
||||
shellInstance = newPersistentShell(workingDir)
|
||||
})
|
||||
|
||||
if !shellInstance.isAlive {
|
||||
if shellInstance == nil || !shellInstance.isAlive {
|
||||
shellInstance = newPersistentShell(shellInstance.cwd)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user