mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 04:32:55 +00:00
Quick fix for crashes when mpd stops
This commit is contained in:
parent
f0d0a03b8e
commit
38f05de4ca
@ -484,10 +484,12 @@ void mpd_clearError(mpd_Connection *connection)
|
||||
|
||||
void mpd_closeConnection(mpd_Connection *connection)
|
||||
{
|
||||
closesocket(connection->sock);
|
||||
free_and_zero(connection->returnElement);
|
||||
free_and_zero(connection->request);
|
||||
free(connection);
|
||||
if (connection) {
|
||||
closesocket(connection->sock);
|
||||
free_and_zero(connection->returnElement);
|
||||
free_and_zero(connection->request);
|
||||
free(connection);
|
||||
}
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
@ -699,7 +701,7 @@ static void mpd_getNextReturnElement(mpd_Connection *connection)
|
||||
|
||||
void mpd_finishCommand(mpd_Connection *connection)
|
||||
{
|
||||
while (!connection->doneProcessing) {
|
||||
while (connection && !connection->doneProcessing) {
|
||||
if (connection->doneListOk) {
|
||||
connection->doneListOk = 0;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ namespace {
|
||||
mpd_info.status = "MPD not responding";
|
||||
}
|
||||
mpd_finishCommand(conn);
|
||||
if (conn->error) {
|
||||
if (!conn || conn->error) {
|
||||
// fprintf(stderr, "%s\n", conn->errorStr);
|
||||
mpd_closeConnection(conn);
|
||||
conn = 0;
|
||||
@ -277,7 +277,7 @@ if (b) a=b; else a="";
|
||||
}
|
||||
}
|
||||
mpd_finishCommand(conn);
|
||||
if (conn->error) {
|
||||
if (conn && conn->error) {
|
||||
// fprintf(stderr, "%s\n", conn->errorStr);
|
||||
mpd_closeConnection(conn);
|
||||
conn = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user