refactor: check conn
This commit is contained in:
parent
9b9d13ab0d
commit
9a123052a0
|
@ -289,9 +289,12 @@ void waybar::modules::MPD::checkErrors(mpd_connection* conn) {
|
||||||
state_ = MPD_STATE_UNKNOWN;
|
state_ = MPD_STATE_UNKNOWN;
|
||||||
throw std::runtime_error("Connection to MPD closed");
|
throw std::runtime_error("Connection to MPD closed");
|
||||||
default:
|
default:
|
||||||
auto error_message = mpd_connection_get_error_message(conn);
|
if (conn) {
|
||||||
mpd_connection_clear_error(conn);
|
auto error_message = mpd_connection_get_error_message(conn);
|
||||||
throw std::runtime_error(std::string(error_message));
|
mpd_connection_clear_error(conn);
|
||||||
|
throw std::runtime_error(std::string(error_message));
|
||||||
|
}
|
||||||
|
throw std::runtime_error("Invalid connection");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue