Skip to content

Commit

Permalink
(#39) Throw an exception in case of unparseable IP address
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed Jan 27, 2022
1 parent bdf7c3c commit 4314204
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/Stylophone.Common/Services/MPDConnectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ private void ClearResources()
private async Task TryConnecting(CancellationToken token)
{
if (token.IsCancellationRequested) return;
if (!IPAddress.TryParse(_host, out var ipAddress)) return;
if (!IPAddress.TryParse(_host, out var ipAddress))
throw new Exception("Invalid IP address");

_mpdEndpoint = new IPEndPoint(ipAddress, _port);

Expand Down

0 comments on commit 4314204

Please sign in to comment.