Commit f2f1801c authored by Max Kellermann's avatar Max Kellermann

db/proxy: check connect error before initializing SocketMonitor

Fixes crash bug because mpd_connection_get_async() was called without a connection.
parent 9da57e74
......@@ -353,19 +353,19 @@ ProxyDatabase::Connect(Error &error)
return false;
}
if (!CheckError(connection, error)) {
mpd_connection_free(connection);
connection = nullptr;
return false;
}
idle_received = unsigned(-1);
is_idle = false;
SocketMonitor::Open(mpd_async_get_fd(mpd_connection_get_async(connection)));
IdleMonitor::Schedule();
if (!CheckError(connection, error)) {
if (connection != nullptr)
Disconnect();
return false;
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment