- fix: app crash when ctrl+click on a #include statement that point to a directory instead of header file.

This commit is contained in:
Roy Qu 2022-01-21 19:32:12 +08:00
parent 9af7c736d9
commit c595b6e9da
3 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@ Red Panda C++ Version 0.13.3
- fix: when show function tips, can't correctly calcuate the current position in the function param list - fix: when show function tips, can't correctly calcuate the current position in the function param list
- fix: app will become very slow when processing very long lines. - fix: app will become very slow when processing very long lines.
- enhancement: If console pauser doesn't exist, warn and stop running programs. - enhancement: If console pauser doesn't exist, warn and stop running programs.
- fix: app crash when ctrl+click on a #include statement that point to a directory instead of header file.
Red Panda C++ Version 0.13.2 Red Panda C++ Version 0.13.2
- fix: "delete and exit" button in the environtment / folder option page doesn't work correctly - fix: "delete and exit" button in the environtment / folder option page doesn't work correctly

View File

@ -1127,6 +1127,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
QString s = lines()->getString(p.Line - 1); QString s = lines()->getString(p.Line - 1);
if (mParser->isIncludeLine(s)) { if (mParser->isIncludeLine(s)) {
QString filename = mParser->getHeaderFileName(mFilename,s); QString filename = mParser->getHeaderFileName(mFilename,s);
qDebug()<<filename;
Editor * e = pMainWindow->editorList()->getEditorByFilename(filename); Editor * e = pMainWindow->editorList()->getEditorByFilename(filename);
if (e) { if (e) {
e->setCaretPositionAndActivate(1,1); e->setCaretPositionAndActivate(1,1);

View File

@ -361,7 +361,7 @@ Editor *EditorList::getEditorByFilename(QString filename)
//Create a new editor //Create a new editor
QFileInfo fileInfo(filename); QFileInfo fileInfo(filename);
QString fullname = fileInfo.absoluteFilePath(); QString fullname = fileInfo.absoluteFilePath();
if (fileInfo.exists()) if (fileInfo.exists() && fileInfo.isFile())
return newEditor(fullname,ENCODING_AUTO_DETECT,false,false); return newEditor(fullname,ENCODING_AUTO_DETECT,false,false);
return nullptr; return nullptr;
} }