Skip to content

Commit af6c0ff

Browse files
committed
Fix nullptr exception with invalid credentials
1 parent c2fb85c commit af6c0ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/AwsIotChannel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ AwsIotChannel::subscribe()
9696
{
9797
TraceModule::get().incrementAtomicVariable( TraceAtomicVariable::SUBSCRIBE_ERROR );
9898
// coverity[cert_str51_cpp_violation] - pointer comes from std::string, which can't be null
99-
auto reasonString = std::string( subAckPacket->getReasonString()->c_str() != nullptr
99+
auto reasonString = std::string( subAckPacket->getReasonString().has_value()
100100
? subAckPacket->getReasonString()->c_str()
101101
: "Unknown reason" );
102102
FWE_LOG_ERROR( "Server rejected subscription to topic " + mTopicName + ". Reason code " +

0 commit comments

Comments
 (0)