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