3

Fix more nullability warnings that only show up on the command line f… · nodatim...

 3 years ago
source link: https://github.com/nodatime/nodatime/commit/051de51c15624e5360c7bd30f4477aceec167001
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Fix more nullability warnings that only show up on the command line f… · nodatime/nodatime@051de51 · GitHubPermalink

Browse files

Fix more nullability warnings that only show up on the command line f…

…or some reason

jskeet

committed on May 25, 2019

1 parent 24c42a7 commit 051de51c15624e5360c7bd30f4477aceec167001
Showing with 9 additions and 5 deletions.

@@ -66,7 +66,7 @@ internal static class Cultures

}

});

private static string[] LowerCaseFrench(Func<DateTimeFormatInfo, string[]> propertySelector) =>

private static string?[] LowerCaseFrench(Func<DateTimeFormatInfo, string[]> propertySelector) =>

propertySelector(new CultureInfo("fr-FR").DateTimeFormat).Select(x => x?.ToLowerInvariant()).ToArray();

internal static readonly CultureInfo DotTimeSeparator = CultureInfo.ReadOnly(new CultureInfo("fi-FI") {

@@ -84,7 +84,8 @@ internal sealed class NodaFormatInfo

/// <param name="cultureInfo">The culture info to use.</param>

[VisibleForTesting]

internal NodaFormatInfo(CultureInfo cultureInfo)

: this(cultureInfo, cultureInfo?.DateTimeFormat)

// If cultureInfo is null, this will throw before we get to the DateTimeFormatInfo being null.

: this(cultureInfo, cultureInfo?.DateTimeFormat!)

{

}

@@ -399,14 +399,17 @@ public static BclDateTimeZone ForSystemDefault()

}

BclDateTimeZone currentSystemDefault = systemDefault;

// Cached copy is out of date - wrap a new one

// Cached copy is out of date - wrap a new one.

// If currentSystemDefault is null, we always enter this block (as local isn't null).

if (currentSystemDefault?.OriginalZone != local)

{

currentSystemDefault = FromTimeZoneInfo(local);

systemDefault = currentSystemDefault;

}

// Always return our local variable; the variable may have changed again.

return currentSystemDefault;

// Always return our local variable; the field may have changed again.

// The ! is because the compiler doesn't recognize the logic around

// "always fetch if we currentSystemDefault is null".

return currentSystemDefault!;

}

}

}

0 comments on commit 051de51

Please sign in to comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK