mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Guarded personal channel info from possible crash on deleting message.
This commit is contained in:
@@ -1365,8 +1365,20 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
|
|||||||
const auto previewView = lifetime.make_state<MessageView>();
|
const auto previewView = lifetime.make_state<MessageView>();
|
||||||
preview->resize(0, st::infoLabeled.style.font->height);
|
preview->resize(0, st::infoLabeled.style.font->height);
|
||||||
preview->paintRequest(
|
preview->paintRequest(
|
||||||
) | rpl::start_with_next([=](const QRect &rect) {
|
) | rpl::start_with_next([=, fullId = item->fullId()](
|
||||||
|
const QRect &rect) {
|
||||||
auto p = Painter(preview);
|
auto p = Painter(preview);
|
||||||
|
const auto item = user->session().data().message(fullId);
|
||||||
|
if (!item) {
|
||||||
|
p.setPen(st::infoPersonalChannelDateLabel.textFg);
|
||||||
|
p.setBrush(Qt::NoBrush);
|
||||||
|
p.setFont(st::infoPersonalChannelDateLabel.style.font);
|
||||||
|
p.drawText(
|
||||||
|
preview->rect(),
|
||||||
|
tr::lng_deleted_message(tr::now),
|
||||||
|
style::al_left);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (previewView->prepared(item, nullptr)) {
|
if (previewView->prepared(item, nullptr)) {
|
||||||
previewView->paint(p, preview->rect(), {
|
previewView->paint(p, preview->rect(), {
|
||||||
.st = &st::defaultDialogRow,
|
.st = &st::defaultDialogRow,
|
||||||
|
Reference in New Issue
Block a user