mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
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;
|
||||
throw std::runtime_error("Connection to MPD closed");
|
||||
default:
|
||||
auto error_message = mpd_connection_get_error_message(conn);
|
||||
mpd_connection_clear_error(conn);
|
||||
throw std::runtime_error(std::string(error_message));
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user