From b79f8e04625864c645d37928dc90bde41ec5345d Mon Sep 17 00:00:00 2001 From: Jana Cupova Date: Fri, 3 Sep 2021 11:11:32 +0200 Subject: [PATCH] Fix disabled and enabled option when empty result Fixes: https://pagure.io/koji/issue/3015 --- cli/koji_cli/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 9f675404..0edbac43 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3013,7 +3013,10 @@ def anon_handle_list_channels(goptions, session, args): channels = sorted([x for x in session.listChannels(**opts)], key=lambda x: x['name']) except koji.ParameterError: channels = sorted([x for x in session.listChannels()], key=lambda x: x['name']) - first_item = channels[0] + if len(channels) > 0: + first_item = channels[0] + else: + first_item = {} session.multicall = True for channel in channels: session.listHosts(channelID=channel['id'])