Fix room switch so that if there is no saved text the user ends up with an empty chatbar

This commit is contained in:
James Graham
2026-01-30 08:54:49 +00:00
parent 007ebbc003
commit 6e28ada1a4
2 changed files with 3 additions and 6 deletions

View File

@@ -43,12 +43,14 @@ ChatBarMessageContentModel::ChatBarMessageContentModel(QObject *parent)
addAttachment(QUrl(m_room->cacheForType(m_type)->attachmentPath()));
}
clearModel();
const auto textSections = m_room->cacheForType(m_type)->text().split(u"\n\n"_s);
if (textSections.length() == 1 && textSections[0].isEmpty()) {
initializeModel();
return;
}
clearModel();
beginResetModel();
for (const auto &section : textSections) {
const auto type = MessageComponentType::typeForString(section);