Skip to content

Commit

Permalink
Fix "failed to find recorded entry for 0" warnings.
Browse files Browse the repository at this point in the history
Add a couple of checks to the data flow when updating a ProgramInfo
data structure. First, before sending a notification that a
ProgramInfo has changed ensure that the data structure actually
represents a recording (not a video, DVD, Bluray, or stream).  Second,
when receiving a MASTER_UPDATE_REC_INFO message verify that the
recording id number isn't zero.

Fixes #483.

(cherry picked from commit ecac941)
  • Loading branch information
linuxdude42 committed Feb 16, 2022
1 parent badcce2 commit 7acf407
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mythtv/libs/libmyth/programinfo.cpp
Expand Up @@ -2758,7 +2758,8 @@ void ProgramInfo::UpdateLastPlayTimeStamp(bool hasLastPlay) const

void ProgramInfo::SendUpdateEvent(void) const
{
s_updater->insert(m_recordedId, kPIUpdate);
if (IsRecording())
s_updater->insert(m_recordedId, kPIUpdate);
}

void ProgramInfo::SendAddedEvent(void) const
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmyth/programinfoupdater.cpp
Expand Up @@ -10,6 +10,8 @@
void ProgramInfoUpdater::insert(
uint recordedid, PIAction action, uint64_t filesize)
{
if (recordedid == 0)
return;
QMutexLocker locker(&m_lock);
if (kPIUpdate == action || kPIUpdateFileSize == action)
{
Expand Down
2 changes: 2 additions & 0 deletions mythtv/programs/mythbackend/mainserver.cpp
Expand Up @@ -1524,6 +1524,8 @@ void MainServer::customEvent(QEvent *e)
uint recordedid = 0;
if (tokens.size() >= 2)
recordedid = tokens[1].toUInt();
if (recordedid == 0)

This comment has been minimized.

Copy link
@kmdewaal

kmdewaal Feb 16, 2022

Contributor

The issue fixed in this commit, a MASTER_UPDATE_REC_INFO sent without a recordedid value, would not have been caught if there was no error message given.
To catch similar errors in the future I suggest to add an error message if there is no recordedid present.

return;

ProgramInfo evinfo(recordedid);
if (evinfo.GetChanID())
Expand Down

0 comments on commit 7acf407

Please sign in to comment.