3 Commits

Author SHA1 Message Date
ahjephson
d373ec3f6f Merge branch 'master' into develop 2025-11-04 19:43:33 +00:00
ahjephson
b72aae734a Fix bug with tags and torrent removal 2025-11-04 19:42:55 +00:00
ahjephson
fca17edfd1 Merge tag '1.2.0' into develop
1.2.0
2025-10-20 20:56:10 +01:00
2 changed files with 12 additions and 7 deletions

View File

@@ -208,9 +208,14 @@ namespace Lantean.QBTMud.Services
{ {
foreach (var hash in mainData.TorrentsRemoved) foreach (var hash in mainData.TorrentsRemoved)
{ {
if (!torrentList.Torrents.TryGetValue(hash, out var torrent))
{
continue;
}
if (torrentList.Torrents.Remove(hash)) if (torrentList.Torrents.Remove(hash))
{ {
RemoveTorrentFromStates(torrentList, hash); RemoveTorrentFromStates(torrentList, torrent, hash);
dataChanged = true; dataChanged = true;
filterChanged = true; filterChanged = true;
} }
@@ -373,13 +378,8 @@ namespace Lantean.QBTMud.Services
UpdateTrackerState(torrentList, updatedTorrent, hash, previousSnapshot.Tracker); UpdateTrackerState(torrentList, updatedTorrent, hash, previousSnapshot.Tracker);
} }
private static void RemoveTorrentFromStates(MainData torrentList, string hash) private static void RemoveTorrentFromStates(MainData torrentList, Torrent torrent, string hash)
{ {
if (!torrentList.Torrents.TryGetValue(hash, out var torrent))
{
return;
}
var snapshot = CreateSnapshot(torrent); var snapshot = CreateSnapshot(torrent);
torrentList.TagState[FilterHelper.TAG_ALL].Remove(hash); torrentList.TagState[FilterHelper.TAG_ALL].Remove(hash);

View File

@@ -7,6 +7,11 @@ namespace Lantean.QBitTorrentClient.Converters
{ {
public override IReadOnlyList<string>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) public override IReadOnlyList<string>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{ {
if (reader.TokenType == JsonTokenType.Null)
{
return null;
}
if (reader.TokenType != JsonTokenType.String) if (reader.TokenType != JsonTokenType.String)
{ {
throw new JsonException("Must be of type string."); throw new JsonException("Must be of type string.");