fix(mpd): Check m_status before dereferencing it

This bug was introduced in 645a3142a1

Fixes #979
This commit is contained in:
patrick96 2018-01-31 09:45:29 +01:00 committed by NBonaparte
parent 2a056d5b23
commit 26abd0f6c4
2 changed files with 7 additions and 1 deletions

View file

@ -64,6 +64,12 @@ namespace modules {
static constexpr const char* EVENT_SEEK{"mpdseek"};
unique_ptr<mpdconnection> m_mpd;
/*
* Stores the mpdstatus instance for the current connection
* m_status is not initialized if mpd is not connect, you always have to
* make sure that m_status is not NULL before dereferencing it
*/
unique_ptr<mpdstatus> m_status;
string m_host{"127.0.0.1"};

View file

@ -200,7 +200,7 @@ namespace modules {
}
}
if (m_status->match_state(mpdstate::PLAYING)) {
if (m_status && m_status->match_state(mpdstate::PLAYING)) {
// Always update the status while playing
m_status->update(-1, m_mpd.get());
}