aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/UserDataManager.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2022-10-06 20:21:23 +0200
committerBond_009 <bond.009@outlook.com>2022-10-06 20:21:23 +0200
commita9a5fcde81060c9da2096235d61128006339a2ee (patch)
tree3c3f7da26dffcc1a6589bcfc1cec2a5634e92c0e /Emby.Server.Implementations/Library/UserDataManager.cs
parent927fe33d3a0ec7f9e0fb568cfd423c6e8b966c9d (diff)
Use ArgumentNullException.ThrowIfNull helper method
Did a simple search/replace on the whole repo (except the RSSDP project) This reduces LOC and should improve performance (methods containing a throw statement don't get inlined) ``` if \((\w+) == null\) \s+\{ \s+throw new ArgumentNullException\((.*)\); \s+\} ``` ``` ArgumentNullException.ThrowIfNull($1); ```
Diffstat (limited to 'Emby.Server.Implementations/Library/UserDataManager.cs')
-rw-r--r--Emby.Server.Implementations/Library/UserDataManager.cs15
1 files changed, 3 insertions, 12 deletions
diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.cs
index 3810a76c4..aecab7d9c 100644
--- a/Emby.Server.Implementations/Library/UserDataManager.cs
+++ b/Emby.Server.Implementations/Library/UserDataManager.cs
@@ -53,15 +53,9 @@ namespace Emby.Server.Implementations.Library
public void SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
{
- if (userData == null)
- {
- throw new ArgumentNullException(nameof(userData));
- }
+ ArgumentNullException.ThrowIfNull(userData);
- if (item == null)
- {
- throw new ArgumentNullException(nameof(item));
- }
+ ArgumentNullException.ThrowIfNull(item);
cancellationToken.ThrowIfCancellationRequested();
@@ -194,10 +188,7 @@ namespace Emby.Server.Implementations.Library
/// <exception cref="ArgumentNullException"><paramref name="data"/> is <c>null</c>.</exception>
private UserItemDataDto GetUserItemDataDto(UserItemData data)
{
- if (data == null)
- {
- throw new ArgumentNullException(nameof(data));
- }
+ ArgumentNullException.ThrowIfNull(data);
return new UserItemDataDto
{