on main help sign in
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.

commit94aeb7b7fe86b2969c5ff99d88ede7071025d770 authorFuad <justfuad@protonmail.com> dateSat 26 Apr 2025, 23:00 (2 years ago) parenta35466c
1 file changed+1−1
internal/llm/tools/shell/shell.go+1−1
internal/llm/tools/shell/shell.go+1−1
@@ -47,7 +47,7 @@ func GetPersistentShell(workingDir string) *PersistentShell {
4747 shellInstance = newPersistentShell(workingDir)
4848 })
4949
50− if !shellInstance.isAlive {
50+ if shellInstance == nil || !shellInstance.isAlive {
5151 shellInstance = newPersistentShell(shellInstance.cwd)
5252 }
5353