Skip to content

Commit

Permalink
LCDServer: fix coverity ID 700425 Unchecked dynamic_cast
Browse files Browse the repository at this point in the history
In LCDServer::readSocket(): Dynamic_cast may fail and return null if the type
cast is incompatible. Not really possible for sender() to be anything other
than a QTcpSocket* in this case but Coverity doesn't know that.
  • Loading branch information
Paul Harrison committed Jun 10, 2013
1 parent 0975569 commit e8aff2f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions mythtv/programs/mythlcdserver/lcdserver.cpp
Expand Up @@ -135,16 +135,20 @@ void LCDServer::endConnection(void)
void LCDServer::readSocket()
{
QTcpSocket *socket = dynamic_cast<QTcpSocket*>(sender());
m_lastSocket = socket;

while(socket->canReadLine())
if (socket)
{
QString incoming_data = socket->readLine();
incoming_data = incoming_data.replace( QRegExp("\n"), "" );
incoming_data = incoming_data.replace( QRegExp("\r"), "" );
incoming_data.simplified();
QStringList tokens = parseCommand(incoming_data);
parseTokens(tokens, socket);
m_lastSocket = socket;

while(socket->canReadLine())
{
QString incoming_data = socket->readLine();
incoming_data = incoming_data.replace( QRegExp("\n"), "" );
incoming_data = incoming_data.replace( QRegExp("\r"), "" );
incoming_data.simplified();
QStringList tokens = parseCommand(incoming_data);
parseTokens(tokens, socket);
}
}
}

Expand Down

0 comments on commit e8aff2f

Please sign in to comment.