Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trying to perform arithmetic on nil hunk_offset #1527

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

fnune
Copy link
Contributor

@fnune fnune commented Oct 28, 2024

I got this locally. I'm not sure how I got there, but there I was:

...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:507: attempt to perform arithmetic on field 'hunk _offset' (a nil value)
stack traceback:
^I[C]: in function 'error'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'step'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:48: in function 'execute'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:118: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:71: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:334: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:292>

See attempt to perform arithmetic on field 'hunk _offset' (a nil value). This PR works around that by defaulting to 0 if there is no hunk_offset.

I got this locally. I'm not sure how I got there, but there I was:

```
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:507: attempt to perform arithmetic on field 'hunk _offset' (a nil value)
stack traceback:
^I[C]: in function 'error'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'step'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:48: in function 'execute'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:118: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:71: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:334: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:292>
```

See `attempt to perform arithmetic on field 'hunk _offset' (a nil
value)`. This PR works around that by defaulting to `0` if there is no
`hunk_offset`.
@CKolkey CKolkey force-pushed the fnune/fix-hunk-offset-arithmetic branch from de017e2 to b2e226b Compare October 29, 2024 11:36
@CKolkey
Copy link
Member

CKolkey commented Oct 29, 2024

Well I'll be damned, just encountered this too.

@CKolkey CKolkey merged commit ad86259 into NeogitOrg:master Oct 29, 2024
5 checks passed
@fnune fnune deleted the fnune/fix-hunk-offset-arithmetic branch October 29, 2024 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants