mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix crash when editing an edited message pointing to itself
This commit is contained in:
parent
192c3b7a77
commit
3c91b5b47b
1 changed files with 9 additions and 7 deletions
|
@ -1542,13 +1542,11 @@ TimelineModel::setEdit(QString newEdit)
|
||||||
if (edit_ != newEdit) {
|
if (edit_ != newEdit) {
|
||||||
auto ev = events.get(newEdit.toStdString(), "");
|
auto ev = events.get(newEdit.toStdString(), "");
|
||||||
if (ev && mtx::accessors::sender(*ev) == http::client()->user_id().to_string()) {
|
if (ev && mtx::accessors::sender(*ev) == http::client()->user_id().to_string()) {
|
||||||
edit_ = newEdit;
|
auto e = *ev;
|
||||||
emit editChanged(edit_);
|
|
||||||
|
|
||||||
setReply(QString::fromStdString(
|
setReply(QString::fromStdString(
|
||||||
mtx::accessors::relations(*ev).reply_to().value_or("")));
|
mtx::accessors::relations(e).reply_to().value_or("")));
|
||||||
|
|
||||||
auto msgType = mtx::accessors::msg_type(*ev);
|
auto msgType = mtx::accessors::msg_type(e);
|
||||||
if (msgType == mtx::events::MessageType::Text ||
|
if (msgType == mtx::events::MessageType::Text ||
|
||||||
msgType == mtx::events::MessageType::Notice) {
|
msgType == mtx::events::MessageType::Notice) {
|
||||||
input()->setText(relatedInfo(newEdit).quoted_body);
|
input()->setText(relatedInfo(newEdit).quoted_body);
|
||||||
|
@ -1557,11 +1555,15 @@ TimelineModel::setEdit(QString newEdit)
|
||||||
} else {
|
} else {
|
||||||
input()->setText("");
|
input()->setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edit_ = newEdit;
|
||||||
} else {
|
} else {
|
||||||
edit_ = "";
|
resetReply();
|
||||||
emit editChanged(edit_);
|
|
||||||
input()->setText("");
|
input()->setText("");
|
||||||
|
edit_ = "";
|
||||||
}
|
}
|
||||||
|
emit editChanged(edit_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue