mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Fix a possible crash in translations.
This commit is contained in:
parent
21857450f3
commit
e1624e5d22
1 changed files with 6 additions and 5 deletions
|
@ -2437,8 +2437,8 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
: QString();
|
||||
|
||||
if (isUponSelected > 0) {
|
||||
if (!hasCopyRestrictionForSelected()
|
||||
&& !getSelectedText().empty()) {
|
||||
const auto selectedText = getSelectedText();
|
||||
if (!hasCopyRestrictionForSelected() && !selectedText.empty()) {
|
||||
_menu->addAction(
|
||||
((isUponSelected > 1)
|
||||
? tr::lng_context_copy_selected_items(tr::now)
|
||||
|
@ -2446,13 +2446,14 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
[=] { copySelectedText(); },
|
||||
&st::menuIconCopy);
|
||||
}
|
||||
if (!Ui::SkipTranslate(getSelectedText().rich)) {
|
||||
if (!Ui::SkipTranslate(selectedText.rich)) {
|
||||
const auto peer = item->history()->peer;
|
||||
_menu->addAction(tr::lng_context_translate_selected({}), [=] {
|
||||
_controller->show(Box(
|
||||
Ui::TranslateBox,
|
||||
item->history()->peer,
|
||||
peer,
|
||||
MsgId(),
|
||||
getSelectedText().rich,
|
||||
selectedText.rich,
|
||||
hasCopyRestrictionForSelected()));
|
||||
}, &st::menuIconTranslate);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue