Skip to content

Commit

Permalink
fix: output valid JSON if no games installed (#41)
Browse files Browse the repository at this point in the history
Unfortunately, an empty string is not valid JSON, so if JSON mode has
been requested, make sure to output an empty JSON string if there are no
games installed while checking for updates.
  • Loading branch information
rdbrschf authored Oct 2, 2023
1 parent c76dba0 commit 8f7ab26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nile/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def list_updates(self):
games = self.config.get("library")

if not installed_array:
if self.arguments.json:
# An empty string is not valid JSON, so create an empty but
# valid JSON string instead.
print(json.dumps(list()))
self.logger.error("No games installed")
return

Expand Down

0 comments on commit 8f7ab26

Please sign in to comment.