From 8f7ab2650fc730efc8960b5fcd71421d724a4108 Mon Sep 17 00:00:00 2001 From: rdbrschf <54837367+rdbrschf@users.noreply.github.com> Date: Mon, 2 Oct 2023 16:28:29 +0200 Subject: [PATCH] fix: output valid JSON if no games installed (#41) 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. --- nile/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nile/cli.py b/nile/cli.py index 398980f..a00ed9e 100755 --- a/nile/cli.py +++ b/nile/cli.py @@ -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