2.14
knownConditionTrueFalse - Condition 'buffer.isEmpty()' is always false
void Example(const QString& buffer, bool dd) { if(buffer.isEmpty() || (dd && buffer.isEmpty())) { // do something } }
Extracting isEmpty into a Boolean is a workaround. Originally, I took the second isEmpty() out but that is a logic error.
That's a true positive. The second isEmpty() is always false and indicated as such:
isEmpty()
foo.cpp:3:45: style: Condition 'buffer.isEmpty()' is always false [knownConditionTrueFalse] if(buffer.isEmpty() || (dd && buffer.isEmpty())) ^ foo.cpp:3:18: note: Assuming that condition 'buffer.isEmpty()' is not redundant if(buffer.isEmpty() || (dd && buffer.isEmpty())) ^ foo.cpp:3:45: note: Condition 'buffer.isEmpty()' is always false if(buffer.isEmpty() || (dd && buffer.isEmpty())) ^
Log in to post a comment.
2.14
knownConditionTrueFalse - Condition 'buffer.isEmpty()' is always false
void Example(const QString& buffer, bool dd)
{
if(buffer.isEmpty() || (dd && buffer.isEmpty()))
{
// do something
}
}
Extracting isEmpty into a Boolean is a workaround. Originally, I took the second isEmpty() out but that is a logic error.
That's a true positive. The second
isEmpty()
is always false and indicated as such: