Skip to content

Commit 50210ea

Browse files
committed
Potential fix for #1814
1 parent 0a26480 commit 50210ea

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

RetailCoder.VBE/UI/RubberduckUI.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/RubberduckUI.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,4 +1647,10 @@ All our stargazers, likers & followers, for the warm fuzzies
16471647
<data name="SourceControl_OpenCommandPromptFailureTitle" xml:space="preserve">
16481648
<value>Failure opening command prompt</value>
16491649
</data>
1650+
<data name="SourceControl_ActivateProject" xml:space="preserve">
1651+
<value>Please open or activate a project and try again.</value>
1652+
</data>
1653+
<data name="SourceControl_NoActiveProject" xml:space="preserve">
1654+
<value>No active VBProject</value>
1655+
</data>
16501656
</root>

RetailCoder.VBE/UI/SourceControl/SourceControlViewViewModel.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,11 +818,18 @@ private bool ValidRepoExists()
818818
return false;
819819
}
820820

821-
var possibleRepos = _config.Repositories.Where(repo => repo.Id == _vbe.ActiveVBProject.HelpFile);
822-
var possibleCount = possibleRepos.Count();
821+
var project = _vbe.ActiveVBProject ?? (_vbe.VBProjects.Count == 1 ? _vbe.VBProjects.Item(1) : null);
823822

824-
//todo: if none are found, prompt user to create one
825-
return possibleCount == 1;
823+
if (project != null)
824+
{
825+
var possibleRepos = _config.Repositories.Where(repo => repo.Id == _vbe.ActiveVBProject.HelpFile);
826+
return possibleRepos.Count() == 1;
827+
}
828+
829+
ViewModel_ErrorThrown(this,
830+
new ErrorEventArgs(RubberduckUI.SourceControl_NoActiveProject,
831+
RubberduckUI.SourceControl_ActivateProject, NotificationType.Error));
832+
return false;
826833
}
827834

828835
private void ShowFilePicker()

0 commit comments

Comments
 (0)