fixed crash when msr2data is invoked and no tab is open.

This commit is contained in:
suter_a 2017-11-17 16:46:40 +01:00
parent 6162f683c8
commit 5d8a47fe1e

View File

@ -830,7 +830,7 @@ void PTextEdit::setupHelpActions()
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
/** /**
* <p>load an msr-file. * <p>load a msr-file.
* *
* \param f filename * \param f filename
* \param index if == -1, add the file as a new tab, otherwise, replace the contents of the tab at index. * \param index if == -1, add the file as a new tab, otherwise, replace the contents of the tab at index.
@ -2215,7 +2215,12 @@ void PTextEdit::musrMsr2Data()
cmd.append("new"); cmd.append("new");
} }
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); // if NO tab is present use the local directory
QString workDir = QString("./");
if (fTabWidget->count() != 0) {
workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
}
PFitOutputHandler fitOutputHandler(workDir, cmd);
fitOutputHandler.setModal(true); fitOutputHandler.setModal(true);
fFileSystemWatcherActive = false; fFileSystemWatcherActive = false;
fitOutputHandler.exec(); fitOutputHandler.exec();
@ -2239,7 +2244,11 @@ void PTextEdit::musrMsr2Data()
else else
fln += fMsr2DataParam->msrFileExtension + ".msr"; fln += fMsr2DataParam->msrFileExtension + ".msr";
load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln); workDir = QString("./");
if (fTabWidget->count() != 0) {
workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
}
load(workDir + "/" + fln);
} }
break; break;
case 1: // run list file case 1: // run list file
@ -2261,7 +2270,11 @@ void PTextEdit::musrMsr2Data()
else else
fln += fMsr2DataParam->msrFileExtension + ".msr"; fln += fMsr2DataParam->msrFileExtension + ".msr";
load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln); workDir = QString("./");
if (fTabWidget->count() != 0) {
workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
}
load(workDir + "/" + fln);
} }
} }