Skip to content

Commit

Permalink
preparing for user config being null
Browse files Browse the repository at this point in the history
  • Loading branch information
vosmiic committed Apr 10, 2023
1 parent 1ab9fba commit eb96814
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions UpdateProviderStatus.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Globalization;
Expand Down Expand Up @@ -34,7 +35,7 @@ public class UpdateProviderStatus {
private readonly ILogger<UpdateProviderStatus> _logger;

private ApiCallHelpers _apiCallHelpers;
private UserConfig _userConfig;
private UserConfig? _userConfig;
private Type _animeType;
private readonly ILibraryManager _libraryManager;
private readonly IFileSystem _fileSystem;
Expand Down Expand Up @@ -71,7 +72,7 @@ public async Task Update(BaseItem e, Guid userId, bool playedToCompletion) {
video.IndexNumber = 1;
}

_userConfig = Plugin.Instance.PluginConfiguration.UserConfig.FirstOrDefault(item => item.UserId == userId);
_userConfig = Plugin.Instance?.PluginConfiguration.UserConfig.FirstOrDefault(item => item.UserId == userId);
if (_userConfig == null) {
_logger.LogWarning($"The user {userId} does not exist in the plugins config file. Skipping");
return;
Expand Down

0 comments on commit eb96814

Please sign in to comment.