mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-02 19:01:47 +02:00
Fix crash
This commit is contained in:
parent
d7ddfc8b88
commit
3d5744c6b0
3 changed files with 18 additions and 11 deletions
|
@ -204,14 +204,6 @@ int main(int argc, char** argv)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!op.non_option_args().empty())
|
||||
{
|
||||
streamreader::StreamUri uri(op.non_option_args().front());
|
||||
settings.server.host = uri.host;
|
||||
settings.server.port = uri.port.value_or(settings.server.port);
|
||||
settings.server.protocol = uri.scheme;
|
||||
}
|
||||
|
||||
if (versionSwitch->is_set())
|
||||
{
|
||||
cout << "snapclient v" << version::code << (!version::rev().empty() ? (" (rev " + version::rev(8) + ")") : ("")) << "\n"
|
||||
|
@ -313,6 +305,19 @@ int main(int argc, char** argv)
|
|||
else
|
||||
throw SnapException("Invalid log sink: " + settings.logging.sink);
|
||||
|
||||
if (!op.non_option_args().empty())
|
||||
{
|
||||
streamreader::StreamUri uri(op.non_option_args().front());
|
||||
settings.server.host = uri.host;
|
||||
settings.server.protocol = uri.scheme;
|
||||
if (uri.port.has_value())
|
||||
settings.server.port = uri.port.value();
|
||||
else if (settings.server.protocol == "ws")
|
||||
settings.server.port = 1780;
|
||||
else if (settings.server.protocol == "wss")
|
||||
settings.server.port = 1788;
|
||||
}
|
||||
|
||||
#if !defined(HAS_AVAHI) && !defined(HAS_BONJOUR)
|
||||
if (settings.server.host.empty())
|
||||
throw SnapException("Snapserver host not configured and mDNS not available, please configure with \"--host\".");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue