~sircmpwn/aerc

panic: runtime error: index out of range in handleFetchMessages (#127) v1 PROPOSED

Zach Sisco: 1
 panic: runtime error: index out of range in handleFetchMessages (#127)

 1 files changed, 1 insertions(+), 3 deletions(-)
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/patches/6437/mbox | git am -3
Learn more about email & git

[PATCH] panic: runtime error: index out of range in handleFetchMessages (#127) Export this patch

---
Removing the conditional expression prevents the "index out of range" 
error in handleFetchMessages(). The conditional expression has no 
relation on the state change handled by the FetchDirectoryContents 
action. I.e., even if `store.DirInfo.Exists == len(store.Uids)`, dir 
contents still need to be fetched because the length of the IMAPWorker's
seqMap needs updated to the currently fetched directory (and 
handleFetchDirectoryContents() is the only place where that happens). 

 lib/msgstore.go | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/msgstore.go b/lib/msgstore.go
index 45a9fb6..09cf31f 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -132,9 +132,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
 	switch msg := msg.(type) {
 	case *types.DirectoryInfo:
 		store.DirInfo = *msg
-		if store.DirInfo.Exists != len(store.Uids) {
-			store.worker.PostAction(&types.FetchDirectoryContents{}, nil)
-		}
+		store.worker.PostAction(&types.FetchDirectoryContents{}, nil)
 		update = true
 	case *types.DirectoryContents:
 		newMap := make(map[uint32]*types.MessageInfo)
-- 
2.11.0
Thanks!

To git.sr.ht:~sircmpwn/aerc
   546dfcd..5b4e592  master -> master
View this thread in the archives