Skip to content

Commit

Permalink
fixed poster picker crash when game not pickedById
Browse files Browse the repository at this point in the history
  • Loading branch information
DineshSolanki committed Aug 7, 2021
1 parent b36ef82 commit 88e0fa9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions FoliCon/ViewModels/PosterPickerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public async void LoadData()
var resultType = Result.MediaType;
var response = _isPickedById
? resultType == MediaTypes.Game ? Result.Result[0] : Result.Result
: resultType == MediaTypes.Game ? Result.Result : Result.Result.Results[PickedIndex];
: resultType == MediaTypes.Game ? Result.Result[PickedIndex] : Result.Result.Results[PickedIndex];

if (resultType != MediaTypes.Game)
{
Expand Down Expand Up @@ -240,7 +240,7 @@ private void PickMethod(object parameter)
var link = (string)parameter;
var result = _isPickedById
? Result.MediaType == MediaTypes.Game ? Result.Result[0] : Result.Result
: Result.MediaType == MediaTypes.Game ? Result.Result : Result.Result.Results[PickedIndex];
: Result.MediaType == MediaTypes.Game ? Result.Result[PickedIndex] : Result.Result.Results[PickedIndex];
if (Result.MediaType == MediaTypes.Game)
{
result.Cover.Value.ImageId = link;
Expand Down
15 changes: 8 additions & 7 deletions FoliCon/ViewModels/SearchResultViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private void PickMethod()
else
{
_tmdbObject.ResultPicked(SearchResult.Result, SearchResult.MediaType,
_fullFolderPath, rating,_isPickedById);
_fullFolderPath, rating, _isPickedById);
}
}
else if (SearchMode == MediaTypes.Game)
Expand Down Expand Up @@ -289,15 +289,16 @@ private void MouseDoubleClick()
return;
}
}
_dialogService.ShowPosterPicker(_tmdbObject,_igdbObject, SearchResult, pickedIndex, ResultListViewData.Data,
_isPickedById, r => { });

_dialogService.ShowPosterPicker(_tmdbObject, _igdbObject, SearchResult, pickedIndex,
ResultListViewData.Data,
_isPickedById, r => { });
}
catch (Exception ex)
{
if (ex.Message == "NoPoster")
{
MessageBox.Show(CustomMessageBox.Warning(LangProvider.GetLang("NoPosterFound"), SearchTitle));
}
MessageBox.Show(ex.Message == "NoPoster"
? CustomMessageBox.Warning(LangProvider.GetLang("NoPosterFound"), SearchTitle)
: CustomMessageBox.Warning(ex.Message, LangProvider.GetLang("ExceptionOccurred")));
}
}
}
Expand Down

0 comments on commit 88e0fa9

Please sign in to comment.