diff -ur mutt-1.7.0-orig/imap/imap.c mutt-1.7.0/imap/imap.c
--- mutt-1.7.0-orig/imap/imap.c	2016-08-20 11:06:26.266272415 +0100
+++ mutt-1.7.0/imap/imap.c	2016-08-20 11:07:42.874509429 +0100
@@ -1143,7 +1143,7 @@
   if (!idata->ctx)
     return -1;
 
-  if (!mutt_bit_isset (idata->ctx->rights, right))
+  if (!idata->ctx || !mutt_bit_isset (idata->ctx->rights, right))
     return 0;
 
   if (right == MUTT_ACL_WRITE && !imap_has_flag (idata->flags, name))
