Skip to content

Commit

Permalink
Merge #2303 Handle mod not found in versions tab
Browse files Browse the repository at this point in the history
  • Loading branch information
politas committed Feb 24, 2018
2 parents d926135 + 89fe7bf commit 60588c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ All notable changes to this project will be documented in this file.
### Bugfixes

- [Multiple] Fix crash when trying to view empty auth token list (#2301 by: HebaruSan; reviewed: politas)
- [GUI] Handle mod not found in versions tab (#2303 by: HebaruSan; reviewed: politas)


## v1.24.0
## v1.24.0 (Bruce)

### Features

Expand Down
27 changes: 20 additions & 7 deletions GUI/MainAllModVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Data;
using System.Linq;
using System.Windows.Forms;
using CKAN.Versioning;

namespace CKAN
{
Expand All @@ -13,22 +14,34 @@ public MainAllModVersions()
InitializeComponent();
}

public GUIMod SelectedModule {
public GUIMod SelectedModule
{
set
{
this.VersionsListView.Items.Clear();
VersionsListView.Items.Clear();

KSP currentInstance = Main.Instance.Manager.CurrentInstance;
var registry = RegistryManager.Instance(currentInstance).registry;
IRegistryQuerier registry = RegistryManager.Instance(currentInstance).registry;

List<CkanModule> allAvailableVersions = registry.AllAvailable(value.Identifier).OrderByDescending((m)=>m.version).ToList();
List<CkanModule> allAvailableVersions;
try
{
allAvailableVersions = registry.AllAvailable(value.Identifier)
.OrderByDescending(m => m.version)
.ToList();
}
catch (ModuleNotFoundKraken)
{
// No versions to be shown, abort and hope an auto refresh happens
return;
}

var kspVersionCriteria = currentInstance.VersionCriteria();
KspVersionCriteria kspVersionCriteria = currentInstance.VersionCriteria();
Version installedVersion = registry.InstalledVersion(value.Identifier);

bool latestCompatibleVersionAlreadyFound = false;
this.VersionsListView.Items.AddRange(allAvailableVersions.Select((module)=> {

VersionsListView.Items.AddRange(allAvailableVersions.Select(module =>
{
ListViewItem toRet = new ListViewItem();
if (module.IsCompatibleKSP(kspVersionCriteria))
{
Expand Down

0 comments on commit 60588c0

Please sign in to comment.