Skip to content

Commit

Permalink
Always check the return value of QSqlQuery::next() and QSqlQuery::exe…
Browse files Browse the repository at this point in the history
…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 9f7cb75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion mythtv/programs/mythbackend/scheduler.cpp
Expand Up @@ -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() ;
Expand Down
3 changes: 1 addition & 2 deletions mythtv/programs/mythbackend/upnpcdstv.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 9f7cb75

Please sign in to comment.