jesseduffield / jesseduffield/lazygit

Segmetation fault in `stash` operation

Open
#1,766 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Describe the bug**
Segmentation fault, see below.

**To Reproduce**
Steps to reproduce the behavior:
1. Stage some files
2. Edit commit and move file from the commit out into the index (by `Ctrl + P` -> `move patch out into index`), not sure if important or not but the file is not in the current unstashed changes.
3. Confirm warning that the operation requires stashing
4. See error
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5648fd83905e]

goroutine 460 [running]:
github.com/jesseduffield/lazygit/pkg/commands/git_commands.(*StashCommands).Save(0x0, {0xc00061c0f0, 0x5648fda30a60})
github.com/jesseduffield/lazygit/pkg/commands/git_commands/stash.go:51 +0x1e
github.com/jesseduffield/lazygit/pkg/commands/git_commands.(*PatchCommands).MovePatchIntoIndex(0xc00007f5e0, {0xc0004b4600, 0xc0000be680, 0x40}, 0x0, 0x1)
github.com/jesseduffield/lazygit/pkg/commands/git_commands/patch.go:173 +0x9b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).handleMovePatchIntoWorkingTree.func1.1()
github.com/jesseduffield/lazygit/pkg/gui/patch_options_panel.go:137 +0x8f
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).WithWaitingStatus.func1()
github.com/jesseduffield/lazygit/pkg/gui/app_status_manager.go:120 +0x97
github.com/jesseduffield/lazygit/pkg/utils.Safe.func1()
github.com/jesseduffield/lazygit/pkg/utils/utils.go:95 +0x1b
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x5648fd36a485)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:106 +0x67
github.com/jesseduffield/lazygit/pkg/utils.Safe(0x0)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:95 +0x35
created by github.com/jesseduffield/lazygit/pkg/gui.(*Gui).WithWaitingStatus
github.com/jesseduffield/lazygit/pkg/gui/app_status_manager.go:111 +0xef
```

**Expected behavior**
No error.

**Screenshots**
If applicable, add screenshots to help explain your problem.
![grafik](https://user-images.githubusercontent.com/6317761/153245309-e1ce783d-8261-42eb-9cec-778afa89ceaa.png)

**Desktop (please complete the following information):**
- OS: Archlinux
- Lazygit Version: `commit=v0.32.2, build date=2022-01-17T09:11:06Z, build source=binaryRelease, version=0.32.2, os=linux, arch=amd64`

**Additional context**
Stashing the changes without this operation (using `s`) works as expected.

Edit: I just cleaned up and in the process tested a bit more, it seems that it occurs in every repository when trying to pull something of a commit, and there is something which needs to be stashed. I am not sure when it stopped working but I quite frequently use this feature, so it could not be long (~1 week).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.