From 160c293198afc975982ac87e4938c9e97a4e2c17 Mon Sep 17 00:00:00 2001 From: Eric Munson Date: Tue, 1 Jul 2025 17:43:21 -0400 Subject: [PATCH] Fix: Subsonic: Handle uninitialized port config value (#2263) Fix uninitialized port config value The or construction does not seem to protect against None value when there are tranformations applied in the lhs (or evaluates after the str() and int() conversions. This leads to problems when no value is set for port. Change back to the more verbose if port else 443 construction to fix this. Fixes: https://github.com/music-assistant/support/issues/4086 Signed-off-by: Eric B Munson --- music_assistant/providers/opensubsonic/sonic_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/music_assistant/providers/opensubsonic/sonic_provider.py b/music_assistant/providers/opensubsonic/sonic_provider.py index c6b6cf3d..5a75e532 100644 --- a/music_assistant/providers/opensubsonic/sonic_provider.py +++ b/music_assistant/providers/opensubsonic/sonic_provider.py @@ -99,7 +99,7 @@ class OpenSonicProvider(MusicProvider): async def handle_async_init(self) -> None: """Set up the music provider and test the connection.""" port = self.config.get_value(CONF_PORT) - port = int(str(port)) or 443 + port = int(str(port)) if port is not None else 443 path = self.config.get_value(CONF_PATH) if path is None: path = "" -- 2.34.1