prevent crash if no tab is present.

This commit is contained in:
2025-08-19 18:09:29 +02:00
parent 6449fd120f
commit 6cc736d6a5
2 changed files with 44 additions and 14 deletions

View File

@@ -2593,7 +2593,11 @@ void PTextEdit::musrView()
}
QString cmd = fAdmin->getExecPath() + "/musrview";
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
QString fln="./";
PSubTextEdit *ce = currentEditor();
if (ce != nullptr)
fln = *fFilenames.find(currentEditor());
QString workDir = QFileInfo(fln).absolutePath();
QStringList arg;
QString str;
@@ -2662,7 +2666,11 @@ void PTextEdit::musrView2Dat()
return;
QString cmd = fAdmin->getExecPath() + "/musrview";
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
QString fln="./";
PSubTextEdit *ce = currentEditor();
if (ce != nullptr)
fln = *fFilenames.find(currentEditor());
QString workDir = QFileInfo(fln).absolutePath();
QStringList arg;
for (auto it : flns) {
@@ -2729,7 +2737,7 @@ void PTextEdit::musrT0()
}
QString cmd = fAdmin->getExecPath() + "/musrt0";
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
QString workDir = QFileInfo(*fFilenames.find(currentEditor())).absolutePath();
QStringList arg;
QString str;
@@ -2782,6 +2790,9 @@ void PTextEdit::musrT0()
*/
void PTextEdit::musrFT()
{
PSubTextEdit *ce = currentEditor();
if (ce == nullptr)
return;
PGetMusrFTOptionsDialog *dlg = new PGetMusrFTOptionsDialog(*fFilenames.find( currentEditor() ), fMusrFTPrevCmd, fAdmin->getHelpUrl("musrFT"));
@@ -2903,7 +2914,7 @@ void PTextEdit::musrSetSteps()
#if defined(Q_OS_DARWIN)
cmd = QString("/Applications/musrStep.app/Contents/MacOS/musrStep");
#endif
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
QString workDir = QFileInfo(*fFilenames.find( currentEditor())).absolutePath();
QStringList arg;
QString str;
@@ -3093,7 +3104,11 @@ void PTextEdit::mupp()
QProcess *proc = new QProcess(this);
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
QString fln="./";
PSubTextEdit *ce = currentEditor();
if (ce != nullptr)
fln = *fFilenames.find(currentEditor());
QString workDir = QFileInfo(fln).absolutePath();
// make sure that the system environment variables are properly set
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();