From 949f9141ab4d5041bd4b0b6c34b18b0920bccc6b Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 10 Jan 2019 13:32:36 -0500 Subject: [PATCH] 2019-01-10 Fred Gleason * Fixed a bug in rdairplay(1) and rdvairplayd(1) that caused spurious service information to by generated by the PAD subsystem when updating events in a null log. * Fixed a bug in rdairplay(1) and rdvairplayd(1) that threw a segfault when playing an event in a null log. --- ChangeLog | 6 ++++++ lib/rdlogplay.cpp | 26 +++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffd9269e..cb43e819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18353,3 +18353,9 @@ 2019-01-09 Fred Gleason * Fixed a regression that caused invalid values for PyPAD UID/GID to be loaded. +2019-01-10 Fred Gleason + * Fixed a bug in rdairplay(1) and rdvairplayd(1) that caused + spurious service information to by generated by the PAD subsystem + when updating events in a null log. + * Fixed a bug in rdairplay(1) and rdvairplayd(1) that threw a + segfault when playing an event in a null log. diff --git a/lib/rdlogplay.cpp b/lib/rdlogplay.cpp index 23493b74..e1e73b2a 100644 --- a/lib/rdlogplay.cpp +++ b/lib/rdlogplay.cpp @@ -1380,6 +1380,9 @@ void RDLogPlay::resync() bool RDLogPlay::isRefreshable() const { + if(play_log==NULL) { + return false; + } return (play_log->exists())&& (play_log->linkDatetime()==play_link_datetime)&& (play_log->modifiedDatetime()>play_modified_datetime); @@ -2961,15 +2964,20 @@ void RDLogPlay::SendNowNext() // // Service // - RDSvc *svc=new RDSvc(svcname,rda->station(),rda->config(),this); - play_pad_socket->write(QString(" \"service\": {\r\n").toUtf8()); - play_pad_socket->write(RDJsonField("name",svcname,12).toUtf8()); - play_pad_socket-> - write(RDJsonField("description",svc->description(),12).toUtf8()); - play_pad_socket-> - write(RDJsonField("programCode",svc->programCode(),12,true).toUtf8()); - play_pad_socket->write(QString(" },\r\n").toUtf8()); - delete svc; + if(svcname.isEmpty()) { + play_pad_socket->write(RDJsonNullField("service",8).toUtf8()); + } + else { + RDSvc *svc=new RDSvc(svcname,rda->station(),rda->config(),this); + play_pad_socket->write(QString(" \"service\": {\r\n").toUtf8()); + play_pad_socket->write(RDJsonField("name",svcname,12).toUtf8()); + play_pad_socket-> + write(RDJsonField("description",svc->description(),12).toUtf8()); + play_pad_socket-> + write(RDJsonField("programCode",svc->programCode(),12,true).toUtf8()); + play_pad_socket->write(QString(" },\r\n").toUtf8()); + delete svc; + } // // Log