Avoid undefined value access when the channel list is empty. Fixes: #5937, #5951 Signed-off-by: Jo-Philipp Wich <jo@mein.io>