Browse Source

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.
Fuad 11 tháng trước cách đây
mục cha
commit
94aeb7b7fe
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      internal/llm/tools/shell/shell.go

+ 1 - 1
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)
 	}