Skip to content

Commit

Permalink
Fix a crash when the attached file is no more readable
Browse files Browse the repository at this point in the history
...any more.
  • Loading branch information
Kitsune Ral committed Jan 31, 2024
1 parent 44eea0f commit d0c07c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/chatroomwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,11 @@ QString ChatRoomWidget::checkAttachment()
if (m_fileToAttach->open(QIODevice::ReadOnly))
return {};

// Form the message in advance while the file name is still there
const auto msg =
tr("%1 is not readable or not a file").arg(m_fileToAttach->fileName());
cancelAttaching();
return tr("%1 is not readable or not a file").arg(m_fileToAttach->fileName());
return msg;
}

void ChatRoomWidget::cancelAttaching()
Expand Down

0 comments on commit d0c07c5

Please sign in to comment.