diff --git a/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs b/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs index 2ea9499790..b7f698ff3a 100644 --- a/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs +++ b/osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs @@ -4,6 +4,7 @@ #nullable enable using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; namespace osu.Framework.Extensions.ObjectExtensions { @@ -31,11 +32,11 @@ public static T AsNonNull(this T? obj) /// /// If the given object is null. /// - public static bool IsNull(this T obj) => ReferenceEquals(obj, null); + public static bool IsNull([NotNullWhen(false)] this T obj) => ReferenceEquals(obj, null); /// /// true if the given object is not null, false otherwise. /// - public static bool IsNotNull(this T obj) => !ReferenceEquals(obj, null); + public static bool IsNotNull([NotNullWhen(true)] this T obj) => !ReferenceEquals(obj, null); } }