This repository was archived by the owner on Jun 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,7 @@ public override bool LoadData(ref PluginDataConfig config, bool enabled)
4747 {
4848 if ( enabled )
4949 {
50- if ( config is GitHubPluginConfig githubConfig &&
51- ( string . IsNullOrWhiteSpace ( githubConfig . SelectedVersion ) || AlternateVersions . Any ( x => x . Name . Equals ( githubConfig . SelectedVersion , StringComparison . OrdinalIgnoreCase ) ) ) )
50+ if ( config is GitHubPluginConfig githubConfig && IsValidConfig ( githubConfig ) )
5251 {
5352 this . config = githubConfig ;
5453 return false ;
@@ -71,6 +70,15 @@ public override bool LoadData(ref PluginDataConfig config, bool enabled)
7170 return false ;
7271 }
7372
73+ private bool IsValidConfig ( GitHubPluginConfig githubConfig )
74+ {
75+ if ( string . IsNullOrWhiteSpace ( githubConfig . SelectedVersion ) )
76+ return true ;
77+ if ( AlternateVersions == null )
78+ return false ;
79+ return AlternateVersions . Any ( x => x . Name . Equals ( githubConfig . SelectedVersion , StringComparison . OrdinalIgnoreCase ) ) ;
80+ }
81+
7482 public void InitPaths ( )
7583 {
7684 string [ ] nameArgs = Id . Split ( new char [ ] { '/' , '\\ ' } , StringSplitOptions . RemoveEmptyEntries ) ;
@@ -147,7 +155,7 @@ public override Assembly GetAssembly()
147155
148156 private string GetSelectedCommit ( )
149157 {
150- if ( string . IsNullOrWhiteSpace ( config . SelectedVersion ) )
158+ if ( config == null || string . IsNullOrWhiteSpace ( config . SelectedVersion ) || AlternateVersions == null )
151159 return Commit ;
152160 Branch branch = AlternateVersions . FirstOrDefault ( x => x . Name . Equals ( config . SelectedVersion , StringComparison . OrdinalIgnoreCase ) ) ;
153161 if ( branch == null )
You can’t perform that action at this time.
0 commit comments