Permalink
Browse files

Always check the return value of QSqlQuery::next() and QSqlQuery::exe…

…c() before accessing results in Scheduler::UpdateManuals() and UPnpCDSTv::AddItem(). Coverity defects 700275 and 700276.
  • Loading branch information...
stuartm committed May 24, 2012
1 parent 9bddf5b commit 9f7cb75fd428abffcc535865abe769f10cf66732
Showing with 4 additions and 3 deletions.
  1. +3 −1 mythtv/programs/mythbackend/scheduler.cpp
  2. +1 −2 mythtv/programs/mythbackend/upnpcdstv.cpp
@@ -3197,7 +3197,9 @@ void Scheduler::UpdateManuals(uint recordid)
return;
}
- query.next();
+ if (!query.next())
+ return;
+
RecordingType rectype = RecordingType(query.value(0).toInt());
QString title = query.value(1).toString();
QString station = query.value(2).toString() ;
@@ -423,8 +423,7 @@ void UPnpCDSTv::AddItem( const UPnpCDSRequest *pRequest,
"starttime=:STARTTIME AND type = 33" );
query2.bindValue(":CHANID", (int)nChanid);
query2.bindValue(":STARTTIME", dtProgStart.toString("yyyy/MM/dd hh:mm:ss"));
- query2.exec();
- if (query2.next())
+ if (query2.exec() && query2.next())
uiDur = query2.value(0).toUInt() / 1000;
QString sDur;

0 comments on commit 9f7cb75

Please sign in to comment.