forked from qt-creator/qt-creator
Fixed crash when renaming a file not under source control
Reported by Cameron Hart on the mailing list. Reviewed-by: dt
This commit is contained in:
@@ -2058,7 +2058,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
|
|||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
Core::IVersionControl *vc = core->vcsManager()->findVersionControlForDirectory(dir);
|
Core::IVersionControl *vc = core->vcsManager()->findVersionControlForDirectory(dir);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (vc->supportsOperation(Core::IVersionControl::MoveOperation))
|
if (vc && vc->supportsOperation(Core::IVersionControl::MoveOperation))
|
||||||
result = vc->vcsMove(orgFilePath, newFilePath);
|
result = vc->vcsMove(orgFilePath, newFilePath);
|
||||||
if (!result) // The moving via vcs failed or the vcs does not support moving, fall back
|
if (!result) // The moving via vcs failed or the vcs does not support moving, fall back
|
||||||
result = QFile::rename(orgFilePath, newFilePath);
|
result = QFile::rename(orgFilePath, newFilePath);
|
||||||
|
Reference in New Issue
Block a user