~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH] Fix crash on mouse scrolling before messages load

Details
Message ID
<20200222160546.57083-1-wiktor@metacode.biz>
DKIM signature
missing
Download raw message
Patch: +6 -2
Using mouse scroll before messages load will trigger a panic as
`ml.store` has not been assigned yet and is `nil`.
---
 widgets/msglist.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/widgets/msglist.go b/widgets/msglist.go
index 9aff0d4..51c133c 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -163,10 +163,14 @@ func (ml *MessageList) MouseEvent(localX int, localY int, event tcell.Event) {
				ml.aerc.NewTab(viewer, msg.Envelope.Subject)
			}
		case tcell.WheelDown:
			ml.store.Next()
			if ml.store != nil {
				ml.store.Next()
			}
			ml.Scroll()
		case tcell.WheelUp:
			ml.store.Prev()
			if ml.store != nil {
				ml.store.Prev()
			}
			ml.Scroll()
		}
	}
-- 
2.25.1
Details
Message ID
<C0STKXI2JEIN.3A1R6E2LJ0I15@homura>
In-Reply-To
<20200222160546.57083-1-wiktor@metacode.biz> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/aerc
   cb04629..1455ad9  master -> master
Details
Message ID
<a1b21fa7-a8fc-41ce-b845-6595b0ad37fe@www.fastmail.com>
In-Reply-To
<20200222160546.57083-1-wiktor@metacode.biz> (view parent)
DKIM signature
missing
Download raw message
Curious to know – was this in response to https://todo.sr.ht/~sircmpwn/aerc2/348
(Crash on embedded terminal mouse scroll event), or was it unrelated?

On Sat, Feb 22, 2020, at 18:05, Wiktor Kwapisiewicz wrote:
> Using mouse scroll before messages load will trigger a panic as
> `ml.store` has not been assigned yet and is `nil`.
Details
Message ID
<89e8c02b-fce9-d3b3-69f1-294a9c00cd78@metacode.biz>
In-Reply-To
<a1b21fa7-a8fc-41ce-b845-6595b0ad37fe@www.fastmail.com> (view parent)
DKIM signature
missing
Download raw message
On 23.02.2020 09:18, Amir Yalon wrote:
> Curious to know – was this in response to https://todo.sr.ht/~sircmpwn/aerc2/348
> (Crash on embedded terminal mouse scroll event), or was it unrelated?

To be honest I first saw your issue, tried to reproduce it, but then 
found a different bug (that looked similar) and fixed that one.

I should've attached the stacktrace to my commit as it shows the panic 
comes from a different part of code (msglist.go) that your trace doesn't 
have.

I do suspect that fix to your code should also be simple if != nil in 
the line that the stacktrace shows. If you're interested in fixing it 
I'd recommend building from source, reproducing, checking the exact 
line, adding if != nil and then recompiling and re-checking.

Hope that helps!

Kind regards,
Wiktor

-- 
https://metacode.biz/@wiktor
Reply to thread Export thread (mbox)