Skip to content

Commit 5edf794

Browse files
committed
qmdiEditor: dont crash on some scenarios
If the qmdiEditor is not added to a plugin, fix some non null checks.
1 parent 93a1139 commit 5edf794

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/widgets/qmdieditor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,10 @@ void qmdiEditor::handleTabDeselected() {
979979

980980
// FIXME: this is blocking, and wrong
981981
QSet<QString> qmdiEditor::getTagCompletions(const QString &prefix) {
982+
if (!mdiServer || !mdiServer->mdiHost) {
983+
return {};
984+
}
985+
982986
QSet<QString> completions;
983987
auto pluginManager = dynamic_cast<PluginManager *>(mdiServer->mdiHost);
984988
if (!pluginManager) {
@@ -1036,6 +1040,9 @@ void qmdiEditor::handleWordTooltip(const QPoint &localPosition, const QPoint &gl
10361040

10371041
QFuture<CommandArgs> qmdiEditor::getCommandForLocation(const QPoint &localPosition,
10381042
const QString &cmd) {
1043+
if (!mdiServer || !mdiServer->mdiHost) {
1044+
return {};
1045+
}
10391046
auto cursor = textEditor->cursorForPosition(localPosition);
10401047
cursor.select(QTextCursor::WordUnderCursor);
10411048

0 commit comments

Comments
 (0)