Skip to content

Commit 7c8b09e

Browse files
dingodoppeltpljones
andcommitted
Apply suggestions from code review
Co-authored-by: Peter L Jones <pljones@users.noreply.github.com>
1 parent f2ac3e8 commit 7c8b09e

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/server.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,16 +1381,13 @@ void CServer::SendChatTextToAllConChannels ( const int iSendingChanID, const QSt
13811381

13821382
bool CServer::SendChatTextToConChannel ( const int iCurChanID, const QString& strChatText )
13831383
{
1384-
if ( MathUtils::InRange<int> ( iCurChanID, 0, iMaxNumChannels - 1 ) && vecChannels[iCurChanID].IsConnected() )
1384+
if ( !MathUtils::InRange<int> ( iCurChanID, 0, iMaxNumChannels - 1 ) || !vecChannels[iCurChanID].IsConnected() )
13851385
{
1386-
// send message
1387-
vecChannels[iCurChanID].CreateChatTextMes ( strChatText );
1386+
return false;
13881387
}
1389-
else
1390-
{
1391-
return true;
1392-
}
1393-
return false;
1388+
// send message
1389+
vecChannels[iCurChanID].CreateChatTextMes ( strChatText );
1390+
return true;
13941391
}
13951392

13961393
void CServer::CreateAndSendRecorderStateForAllConChannels()

src/serverrpc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ CServerRpc::CServerRpc ( CServer* pServer, CRpcServer* pRpcServer, QObject* pare
129129
return;
130130
}
131131

132-
if ( pServer->SendChatTextToConChannel ( id, chatMessage ) )
132+
if ( !pServer->SendChatTextToConChannel ( id, chatMessage ) )
133133
{
134134
response["error"] = "invalid channel ID";
135135
return;

0 commit comments

Comments
 (0)