aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-04-07 14:46:58 -0500
committerJP Dillingham <jp@dillingham.me>2025-04-07 14:46:58 -0500
commit8c98fc35ca41cf52e6af746e608926b516fe3ad8 (patch)
treee1caeff56d9e8b06ebb08535da6d16f920ea8345
parent8571f94db79d118bf5a2c62a713bb96e5deb9330 (diff)
downloadslskd-8c98fc35ca41cf52e6af746e608926b516fe3ad8.tar.gz
check for configured file before trying to read it
-rw-r--r--src/slskd/Application.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index f13a1c9b..9179987e 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1664,17 +1664,20 @@ namespace slskd
{
byte[] pictureBytes = null;
- try
+ if (!string.IsNullOrWhiteSpace(Options.Soulseek.Picture))
{
- // note: the Picture setting is validated at startup to ensure it exists and that
- // it is readable
- pictureBytes = await System.IO.File.ReadAllBytesAsync(Options.Soulseek.Picture);
- }
- catch (Exception ex)
- {
- // this isn't a serious enough problem to prevent us from continuing, so we'll just
- // log a warning and continue, omitting the picture
- Log.Warning("Failed to read Soulseek picture {Picture}: {Message}", Options.Soulseek.Picture, ex.Message);
+ try
+ {
+ // note: the Picture setting is validated at startup to ensure it exists and that
+ // it is readable
+ pictureBytes = await System.IO.File.ReadAllBytesAsync(Options.Soulseek.Picture);
+ }
+ catch (Exception ex)
+ {
+ // this isn't a serious enough problem to prevent us from continuing, so we'll just
+ // log a warning and continue, omitting the picture
+ Log.Warning("Failed to read Soulseek picture {Picture}: {Message}", Options.Soulseek.Picture, ex.Message);
+ }
}
if (Users.IsBlacklisted(username, endpoint.Address))