Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit 94aeb7b

Browse files
AvicennaJrkujtimiihoxha
authored andcommitted
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.
1 parent a35466c commit 94aeb7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/llm/tools/shell/shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)