db/proxy: check connect error before initializing SocketMonitor
Fixes crash bug because mpd_connection_get_async() was called without a connection.
This commit is contained in:
parent
9da57e7458
commit
f2f1801c25
@ -353,19 +353,19 @@ ProxyDatabase::Connect(Error &error)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CheckError(connection, error)) {
|
||||||
|
mpd_connection_free(connection);
|
||||||
|
connection = nullptr;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
idle_received = unsigned(-1);
|
idle_received = unsigned(-1);
|
||||||
is_idle = false;
|
is_idle = false;
|
||||||
|
|
||||||
SocketMonitor::Open(mpd_async_get_fd(mpd_connection_get_async(connection)));
|
SocketMonitor::Open(mpd_async_get_fd(mpd_connection_get_async(connection)));
|
||||||
IdleMonitor::Schedule();
|
IdleMonitor::Schedule();
|
||||||
|
|
||||||
if (!CheckError(connection, error)) {
|
|
||||||
if (connection != nullptr)
|
|
||||||
Disconnect();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user