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:
Fuad
2025-04-26 23:00:50 +03:00
committed by Kujtim Hoxha
parent 7710a5c8cb
commit 024118757d
+1 -1
View File
@@ -47,7 +47,7 @@ func GetPersistentShell(workingDir string) *PersistentShell {
shellInstance = newPersistentShell(workingDir)
})
if !shellInstance.isAlive {
if shellInstance == nil || !shellInstance.isAlive {
shellInstance = newPersistentShell(shellInstance.cwd)
}