Skip to content

Commit

Permalink
fix(Search no longer crashes when channel does not exist)
Browse files Browse the repository at this point in the history
  • Loading branch information
schneidermanuel committed Jun 21, 2024
1 parent 05d8d54 commit 6f9de4c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions TwitchLeecher/TwitchLeecher.Services/Services/ApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class ApiService : IApiService
private readonly Regex _rxName = new Regex("NAME\\=\"(?<name>.*?)\\\"");
private readonly Regex _rxResolution = new Regex("RESOLUTION\\=(?<resolution>.*?),");
private IPreferencesService _preferencesService;

private readonly ILogService _logService;
private DateTime? _nextRequest;

#endregion Fields
Expand All @@ -56,11 +56,13 @@ internal class ApiService : IApiService

public ApiService(
IRuntimeDataService runtimeDataService,
IPreferencesService preferencesService
IPreferencesService preferencesService,
ILogService logService
)
{
_runtimeDataService = runtimeDataService;
_preferencesService = preferencesService;
_logService = logService;
}

#endregion Constructors
Expand Down Expand Up @@ -335,6 +337,11 @@ DateTime loadTo
_preferencesService.CurrentPreferences.SearchFavouriteChannels.ToArray();
foreach (var channel in favoriteChannels)
{
if (!ChannelExists(channel))
{
continue;
}

var videos = SearchChannel(
channel,
videoType,
Expand Down Expand Up @@ -920,4 +927,3 @@ public TwitchVideo ParseVideo(JToken videoJson)
#endregion Methods
}
}

0 comments on commit 6f9de4c

Please sign in to comment.