~sircmpwn/aerc

Return nil when msglist is nil in Store() v3 PROPOSED

My previous patch was replied to my first patch (which I now believe 
you aren't supposed to do). It was also broken because I thought I could
send the email using apple mail, but apple mail uses a quoted-printable
encoding. I'm still learning how to use git send-email correctly but I
believe this one should work fine.

Jelle Besseling (1):
  Ignore scroll command when msgstore is nil

 commands/account/next.go | 4 ++--
 widgets/account.go       | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.20.1 (Apple Git-117)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/%3C20190808104851.10139-1-jelle%40pingiun.com%3E/mbox | git am -3
Learn more about email & git

[PATCH v3 1/1] Ignore scroll command when msgstore is nil Export this patch

Fixes ~sircmpwn/aerc2#205. Many functions do a nil check on the store,
so this changes Store() so it returns nil when msglist is nil.

It also places the Scroll() behind the nil check in the next-message command.

https://todo.sr.ht/~sircmpwn/aerc2/205
---
 commands/account/next.go | 4 ++--
 widgets/account.go       | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/commands/account/next.go b/commands/account/next.go
index 7b1f230..1ba4b1b 100644
--- a/commands/account/next.go
+++ b/commands/account/next.go
@@ -65,14 +65,14 @@ func ExecuteNextPrevMessage(args []string, acct *widgets.AccountView, pct bool,
 		store := acct.Store()
 		if store != nil {
 			store.NextPrev(-n)
+			acct.Messages().Scroll()
 		}
-		acct.Messages().Scroll()
 	} else {
 		store := acct.Store()
 		if store != nil {
 			store.NextPrev(n)
+			acct.Messages().Scroll()
 		}
-		acct.Messages().Scroll()
 	}
 	return nil
 }
diff --git a/widgets/account.go b/widgets/account.go
index 07b5010..688b660 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -164,6 +164,9 @@ func (acct *AccountView) Messages() *MessageList {
 }
 
 func (acct *AccountView) Store() *lib.MessageStore {
+	if acct.msglist == nil {
+		return nil
+	}
 	return acct.msglist.Store()
 }
 
-- 
2.20.1 (Apple Git-117)
Thanks!

To git.sr.ht:~sircmpwn/aerc
   a174941..f6df46d  master -> master
View this thread in the archives