From 1a15be1e9e0f541057d55f3d4ab09fb69cadd6be Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 21 Nov 2023 11:25:10 +0100 Subject: [PATCH] sources: drop unreachable log message With forced reselection during source removal selected_source_index can only be INVALID_SOURCE if there are no sources. The "Can't synchronise: no sources" message couldn't be logged even before that as SRC_ReselectSource() resets the index before calling SRC_SelectSource(). Replace the message with an assertion. --- sources.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sources.c b/sources.c index 4bfc1a1..8f6caa0 100644 --- a/sources.c +++ b/sources.c @@ -854,11 +854,9 @@ SRC_SelectSource(SRC_Instance updated_inst) } if (n_sources == 0) { - /* In this case, we clearly cannot synchronise to anything */ - if (selected_source_index != INVALID_SOURCE) { - log_selection_message(LOGS_INFO, "Can't synchronise: no sources", NULL); - selected_source_index = INVALID_SOURCE; - } + /* Removed sources are unselected before actual removal */ + if (selected_source_index != INVALID_SOURCE) + assert(0); return; }