Fix crash when opening a mailbox with empty filter

Fixes #2959