[cli] fix false alarm when printing empty line (#6499)

The OpenThread cli may print false alarms when calling
`OutputLine("")`. Fix accordingly.
This commit is contained in:
Jiacheng Guo
2021-04-21 22:16:04 -07:00
committed by GitHub
parent 01186d6610
commit 6fa74b7674
+1 -1
View File
@@ -332,7 +332,7 @@ static int CliUartOutput(void *aContext, const char *aFormat, va_list aArguments
if (sTxLength == 0)
{
rval = vsnprintf(sTxBuffer, kTxBufferSize, aFormat, aArguments);
VerifyOrExit(rval > 0 && rval < kTxBufferSize, otLogWarnPlat("Failed to format CLI output `%s`", aFormat));
VerifyOrExit(rval >= 0 && rval < kTxBufferSize, otLogWarnPlat("Failed to format CLI output `%s`", aFormat));
sTxHead = 0;
sTxLength = static_cast<uint16_t>(rval);
sSendLength = 0;