From 5965db4fd7344822d116aa7bd23ad2fa2ebfa22e Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Tue, 5 Mar 2024 10:20:57 +0100 Subject: [PATCH] Use ArgumentException.ThrowIfNullOrEmpty throw helper --- osu.Game/IO/WrappedStorage.cs | 3 +-- osu.Game/Online/API/OAuth.cs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/IO/WrappedStorage.cs b/osu.Game/IO/WrappedStorage.cs index 95ff26db6a..5a8f4aef59 100644 --- a/osu.Game/IO/WrappedStorage.cs +++ b/osu.Game/IO/WrappedStorage.cs @@ -80,8 +80,7 @@ namespace osu.Game.IO public override Storage GetStorageForDirectory(string path) { - if (string.IsNullOrEmpty(path)) - throw new ArgumentException("Must be non-null and not empty string", nameof(path)); + ArgumentException.ThrowIfNullOrEmpty(path); if (!path.EndsWith(Path.DirectorySeparatorChar)) path += Path.DirectorySeparatorChar; diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 4829310870..b06d9c6586 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -39,8 +39,8 @@ namespace osu.Game.Online.API internal void AuthenticateWithLogin(string username, string password) { - if (string.IsNullOrEmpty(username)) throw new ArgumentException("Missing username."); - if (string.IsNullOrEmpty(password)) throw new ArgumentException("Missing password."); + ArgumentException.ThrowIfNullOrEmpty(username); + ArgumentException.ThrowIfNullOrEmpty(password); var accessTokenRequest = new AccessTokenRequestPassword(username, password) {