This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
src/managed/Microsoft.DotNet.PlatformAbstractions Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -128,14 +128,8 @@ private static DistroInfo LoadDistroInfo()
128
128
// are backwards compatible.
129
129
private static DistroInfo NormalizeDistroInfo ( DistroInfo distroInfo )
130
130
{
131
- if ( string . IsNullOrEmpty ( distroInfo . VersionId ) )
132
- {
133
- // Some distribution does not have VERSION_ID defined.
134
- // Since we need it, we workaround this by giving it the value "unavailable".
135
- distroInfo . VersionId = "unavailable" ;
136
- }
137
-
138
- int minorVersionNumberSeparatorIndex = distroInfo . VersionId . IndexOf ( '.' ) ;
131
+ // Handle if VersionId is null by just setting the index to -1.
132
+ int minorVersionNumberSeparatorIndex = distroInfo . VersionId ? . IndexOf ( '.' ) ?? - 1 ;
139
133
140
134
if ( distroInfo . Id == "rhel" && minorVersionNumberSeparatorIndex != - 1 )
141
135
{
Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ private static string GetRIDVersion()
52
52
case Platform . Windows :
53
53
return GetWindowsProductVersion ( ) ;
54
54
case Platform . Linux :
55
+ if ( string . IsNullOrEmpty ( OperatingSystemVersion ) )
56
+ {
57
+ return string . Empty ;
58
+ }
59
+
55
60
return $ ".{ OperatingSystemVersion } ";
56
61
case Platform . Darwin :
57
62
return $ ".{ OperatingSystemVersion } ";
You can’t perform that action at this time.
0 commit comments