diff --git a/wpilibc/athena/src/Utility.cpp b/wpilibc/athena/src/Utility.cpp index 741691a63b..1a5325167d 100644 --- a/wpilibc/athena/src/Utility.cpp +++ b/wpilibc/athena/src/Utility.cpp @@ -41,7 +41,7 @@ bool wpi_assert_impl(bool conditionValue, llvm::StringRef conditionText, errorStream << "Assertion \"" << conditionText << "\" "; - if (message[0] != '\0') { + if (!message.empty()) { errorStream << "failed: " << message << std::endl; } else { errorStream << "failed." << std::endl; @@ -78,7 +78,7 @@ void wpi_assertEqual_common_impl(llvm::StringRef valueA, llvm::StringRef valueB, errorStream << "Assertion \"" << valueA << " " << equalityType << " " << valueB << "\" "; - if (message[0] != '\0') { + if (!message.empty()) { errorStream << "failed: " << message << std::endl; } else { errorStream << "failed." << std::endl; diff --git a/wpilibc/sim/src/Utility.cpp b/wpilibc/sim/src/Utility.cpp index 97c02def49..1f386f9818 100644 --- a/wpilibc/sim/src/Utility.cpp +++ b/wpilibc/sim/src/Utility.cpp @@ -69,7 +69,7 @@ bool wpi_assert_impl(bool conditionValue, llvm::StringRef conditionText, llvm::SmallString<128> fileTemp; errorStream << "of " << basename(fileName.c_str(fileTemp)) << " "; - if (message[0] != '\0') { + if (!message.empty()) { errorStream << "failed: " << message << std::endl; } else { errorStream << "failed." << std::endl; @@ -98,7 +98,7 @@ void wpi_assertEqual_common_impl(int valueA, int valueB, // If an error message was specified, include it // Build error string - if (message.size() > 0) { + if (!message.empty()) { error << "Assertion failed: \"" << message << "\", \"" << valueA << "\" " << equalityType << " \"" << valueB << "\" in " << funcName << "() in " << fileName << " at line " << lineNumber << "\n";