diff --git a/src/texstudio.cpp b/src/texstudio.cpp index 4fe4a52889..7b10a1839d 100644 --- a/src/texstudio.cpp +++ b/src/texstudio.cpp @@ -4063,7 +4063,9 @@ void Texstudio::editGotoDefinition(QDocumentCursor c) target = defs.keys().constFirst(); edView = getEditorViewFromHandle(target); if(edView->isHidden()){ - openExternalFile(target->document()->getFileName()); + LatexDocument *ltxdoc = qobject_cast(target->document()); + if(ltxdoc) + openExternalFile(ltxdoc->getFileName()); } } if (!edView) return; diff --git a/src/textanalysis.cpp b/src/textanalysis.cpp index cc8650631a..d2700f6479 100644 --- a/src/textanalysis.cpp +++ b/src/textanalysis.cpp @@ -447,7 +447,8 @@ QByteArray escapeAsCSV(const QString &s) void TextAnalysisDialog::slotExportButton() { - QString fn = FileDialog::getSaveFileName(this, tr("CSV Export"), editor ? editor->document()->getFileName().replace(".tex", ".csv") : QString(), tr("CSV file") + " (*.csv)" ";;" + tr("All files") + " (*)"); + LatexDocument *doc=editor ? qobject_cast(editor->document()): nullptr; + QString fn = FileDialog::getSaveFileName(this, tr("CSV Export"), doc ? doc->getFileName().replace(".tex", ".csv") : QString(), tr("CSV file") + " (*.csv)" ";;" + tr("All files") + " (*)"); if (fn.isEmpty()) return; QFile f(fn); if (!f.open(QFile::WriteOnly))