Repository: lutris/lutris

Issue:
Unable to browse GOG games
### Bug description

I am unable to browse games from connected GOG account.
The login seems to went fine but no games are shown.

### How to Reproduce

Steps to reproduce the behavior:
1. Go to 'Sidebar'
2. Click on 'GOG'
3. Do 'Switch to terminal from witch Lutris was started'
4. See 'The output'


### Expected behavior

Show the list of games from my GOG library.

### Log output

```shell
> lutris --debug
Gtk-Message: 12:40:40.739: Failed to load module "colorreload-gtk-module"
2021-11-27 12:40:40,740: Starting Lutris 0.5.9.1
2021-11-27 12:40:40,760: No cores found
2021-11-27 12:40:41,772: Startup complete
INFO     2021-11-27 12:40:41,773 [startup.check_driver:61]:Running AMD Mesa driver 21.2.1 on Radeon RX 570 Series (POLARIS10, DRM 3.42.0, 5.14.2-artix1-2, LLVM 12.0.1) (0x67df)
INFO     2021-11-27 12:40:41,773 [startup.check_driver:73]:GPU: 1002:67DF 1682:C570 (amdgpu drivers)
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 450, in update_store
    games = self.get_games_from_filters()
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 370, in get_games_from_filters
    return self.get_service_games(service_name)
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 352, in get_service_games
    self.combine_games(game, lutris_games.get(game["appid"])) for game in sorted(
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 345, in get_sort_value
    return sort_defaults[self.view_sorting]
KeyError: 'runner'
INFO     2021-11-27 12:40:45,058 [application.do_shutdown:631]:Shutting down Lutris
```

#### Log from pressing GOG Reload button
```shell
> lutris --debug
2021-11-27 13:29:21,211: Starting Lutris 0.5.9.1
2021-11-27 13:29:21,229: No cores found
2021-11-27 13:29:22,335: Startup complete
INFO     2021-11-27 13:29:22,336 [startup.check_driver:61]:Running AMD Mesa driver 21.2.1 on Radeon RX 570 Series (POLARIS10, DRM 3.42.0, 5.14.2-artix1-2, LLVM 12.0.1) (0x67df)
INFO     2021-11-27 13:29:22,336 [startup.check_driver:73]:GPU: 1002:67DF 1682:C570 (amdgpu drivers)
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 450, in update_store
    games = self.get_games_from_filters()
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 370, in get_games_from_filters
    return self.get_service_games(service_name)
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 352, in get_service_games
    self.combine_games(game, lutris_games.get(game["appid"])) for game in sorted(
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 345, in get_sort_value
    return sort_defaults[self.view_sorting]
KeyError: 'runner'
DEBUG    2021-11-27 13:29:24,401 [http.get:81]:GET https://embed.gog.com/userData.json
DEBUG    2021-11-27 13:29:24,818 [base.wipe_game_cache:265]:Deleting gog cache /home/juraj/.cache/lutris/gog-library.json
DEBUG    2021-11-27 13:29:24,819 [base.wipe_game_cache:113]:Deleting games from service-games for gog
DEBUG    2021-11-27 13:29:24,823 [http.get:81]:GET https://embed.gog.com/userData.json
DEBUG    2021-11-27 13:29:25,098 [http.get:81]:GET https://embed.gog.com/account/getFilteredProducts?mediaType=1&page=1
DEBUG    2021-11-27 13:29:25,760 [http.get:81]:GET https://lutris.net/api/games/service/gog
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 450, in update_store
    games = self.get_games_from_filters()
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 370, in get_games_from_filters
    return self.get_service_games(service_name)
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 352, in get_service_games
    self.combine_games(game, lutris_games.get(game["appid"])) for game in sorted(
  File "/usr/lib/python3.9/site-packages/lutris/gui/lutriswindow.py", line 345, in get_sort_value
    return sort_defaults[self.view_sorting]
KeyError: 'runner'
INFO     2021-11-27 13:29:28,596 [application.do_shutdown:631]:Shutting down Lutris

```

### System Information

```shell
[System]
OS:              Artix Linux rolling n/a
Arch:            x86_64
Kernel:          5.14.2-artix1-2
Desktop:         Not found
Display Server:  x11

[CPU]
Vendor:          AuthenticAMD
Model:           AMD Ryzen 5 3600XT 6-Core Processor
Physical cores:  6
Logical cores:   12

[Memory]
RAM:             62.8 GB
Swap:            0.0 GB

[Graphics]
Vendor:          AMD
OpenGL Renderer: Radeon RX 570 Series (POLARIS10, DRM 3.42.0, 5.14.2-artix1-2, LLVM 12.0.1)
OpenGL Version:  4.6 (Compatibility Profile) Mesa 21.2.1
OpenGL Core:     4.6 (Core Profile) Mesa 21.2.1
OpenGL ES:       OpenGL ES 3.2 Mesa 21.2.1
Vulkan:          Supported
```


### Media (optional)

_No response_

### Checklist:

- [x] I'm not asking for support with a game or the wine runner.
- [X] I have followed the above mentioned guides and have all the graphics and wine dependencies installed.
- [X] I have checked for existing issues that describe my problem prior to opening this one.
- [X] I understand that improperly formatted bug reports may be closed without explanation.


Discussion:

Resolving patch:
diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py
--- a/lutris/gui/lutriswindow.py
+++ b/lutris/gui/lutriswindow.py
@@ -340,13 +340,16 @@ def get_sort_value(game):
                 "installed_at": 0.0,
                 "playtime": 0.0,
             }
+            view_sorting = self.view_sorting
             lutris_game = lutris_games.get(game["appid"])
             if not lutris_game:
-                return sort_defaults[self.view_sorting]
-            value = lutris_game[self.view_sorting]
+                return sort_defaults.get(view_sorting, "")
+            value = lutris_game.get(view_sorting)
             if value:
                 return value
-            return sort_defaults[self.view_sorting]
+            # Users may have obsolete view_sorting settings, so
+            # we must tolerate them. We treat them all as blank.
+            return sort_defaults.get(view_sorting, "")
 
         return [
             self.combine_games(game, lutris_games.get(game["appid"])) for game in sorted(


Test patch: