Skip to content

Commit

Permalink
Fix nullptr exception with invalid credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
hefroy committed Dec 20, 2023
1 parent c2fb85c commit be3524b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/AwsIotChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ AwsIotChannel::subscribe()
{
TraceModule::get().incrementAtomicVariable( TraceAtomicVariable::SUBSCRIBE_ERROR );
// coverity[cert_str51_cpp_violation] - pointer comes from std::string, which can't be null
auto reasonString = std::string( subAckPacket->getReasonString()->c_str() != nullptr
auto reasonString = std::string( subAckPacket->getReasonString().has_value()
? subAckPacket->getReasonString()->c_str()
: "Unknown reason" );
FWE_LOG_ERROR( "Server rejected subscription to topic " + mTopicName + ". Reason code " +
Expand Down

0 comments on commit be3524b

Please sign in to comment.