Skip to content

Commit

Permalink
Fix: Crashes when GOG metadata download fails
Browse files Browse the repository at this point in the history
  • Loading branch information
qfulsher committed Oct 28, 2017
1 parent b32c9bd commit 8579cd0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
7 changes: 6 additions & 1 deletion source/Playnite/Providers/GOG/GogLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using NLog;
using Playnite.Database;
using Playnite.Models;
using Playnite.Providers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down Expand Up @@ -192,6 +191,12 @@ public GogGameMetadata UpdateGameWithMetadata(IGame game)
}

var metadata = DownloadGameMetadata(game.ProviderId, currentUrl);
if(metadata.GameDetails == null)
{
logger.Warn($"Could not gather metadata for game {0}.", game.Id);
return metadata;
}

game.Name = metadata.GameDetails.title;
game.Description = metadata.GameDetails.description.full;
game.Links = new ObservableCollection<Link>()
Expand Down
18 changes: 7 additions & 11 deletions source/Playnite/Providers/GOG/WebApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using System;
using CefSharp;
using CefSharp.Wpf;
using Newtonsoft.Json;
using NLog;
using Playnite.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using CefSharp;
using CefSharp.Wpf;
using Newtonsoft.Json;
using NLog;
using Playnite.Controls;

namespace Playnite.Providers.GOG
{
Expand Down Expand Up @@ -89,7 +85,7 @@ public static ProductApiDetail GetGameDetails(string id)
}
catch (WebException exc)
{
logger.Warn(exc, "Failed to download origin game details for " + id);
logger.Warn(exc, "Failed to download GOG game details for " + id);
return null;
}
}
Expand Down

0 comments on commit 8579cd0

Please sign in to comment.