mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
Mail: Fix crash when closing window before IMAP::Client connects
`MailWidget::m_imap_client` is only assigned after a connection is established, so the user might close the main window before that happens, especially if the connection hangs for whatever reason. Now we check the `OwnPtr` before working with it.
This commit is contained in:
parent
055d2b6c8a
commit
08fb98caac
1 changed files with 4 additions and 0 deletions
|
@ -163,6 +163,10 @@ bool MailWidget::connect_and_login()
|
|||
|
||||
void MailWidget::on_window_close()
|
||||
{
|
||||
if (!m_imap_client) {
|
||||
// User closed main window before a connection was established
|
||||
return;
|
||||
}
|
||||
auto response = move(MUST(m_imap_client->send_simple_command(IMAP::CommandType::Logout)->await()).release_value().get<IMAP::SolidResponse>());
|
||||
VERIFY(response.status() == IMAP::ResponseStatus::OK);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue