Skip to content

Commit

Permalink
Add a check for null
Browse files Browse the repository at this point in the history
  • Loading branch information
hadashiA committed Jan 18, 2024
1 parent 719a296 commit 13333a3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/NuGetForUnity/Editor/NugetAssetPostprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,20 @@ private static void ModifyImportSettingsOfRoslynAnalyzer([NotNull] PluginImporte
.Select(GetRoslynVersionNumberFromAnalyzerPath)
.Where(ver =>
{
if (ver == null)
{
return false;
}
#if UNITY_2022_3_OR_NEWER && !UNITY_2022_3_1 && !UNITY_2022_3_2 && !UNITY_2022_3_3 && !UNITY_2022_3_3 && !UNITY_2022_3_4 && !UNITY_2022_3_5 && !UNITY_2022_3_6 && !UNITY_2022_3_7 && !UNITY_2022_3_8 && !UNITY_2022_3_9 && !UNITY_2022_3_10 && !UNITY_2022_3_11
return string.CompareOrdinal(ver, "4.3.0") <= 0;
return string.CompareOrdinal(ver, "4.3.0") <= 0;
#elif UNITY_2022_2_OR_NEWER
return string.CompareOrdinal(ver, "4.1.0") <= 0;
return string.CompareOrdinal(ver, "4.1.0") <= 0;
#elif UNITY_2021_2_OR_NEWER
return string.CompareOrdinal(ver, "3.8.0") <= 0;
return string.CompareOrdinal(ver, "3.8.0") <= 0;
#else
return false;
return false;
#endif
})
})
.ToArray();

// If most recent valid analyzers exist elsewhere, remove label `RoslynAnalyzer`
Expand Down

0 comments on commit 13333a3

Please sign in to comment.