Fixed possible crash on summarizing of caption from grouped media.

This commit is contained in:
23rd
2026-01-06 09:11:19 +03:00
parent 6d145be8d2
commit 0d853c9393
@@ -1677,6 +1677,11 @@ void Element::validateText() {
return;
}
}
// Albums may show text of a different item than the parent one.
// Media::itemForText may initialize data within the object.
_textItem = _media ? _media->itemForText() : item.get();
const auto &summary = item->summaryEntry();
const auto summaryShownWas = (_flags & Flag::SummaryShown) != 0;
const auto summaryShownNow = !summary.result.empty() && summary.shown;
@@ -1684,7 +1689,6 @@ void Element::validateText() {
if (summaryShownNow) {
_flags |= Flag::SummaryShown;
if (summaryShownChanged) {
_textItem = item;
setTextWithLinks(summary.result);
}
return;
@@ -1692,8 +1696,6 @@ void Element::validateText() {
_flags &= ~Flag::SummaryShown;
}
// Albums may show text of a different item than the parent one.
_textItem = _media ? _media->itemForText() : item.get();
if (!_textItem) {
if (!_text.isEmpty()) {
setTextWithLinks({});