From be3524b2d954dc516e83c1b9fa945c3d932fddb1 Mon Sep 17 00:00:00 2001 From: Geoff Phillips Date: Wed, 20 Dec 2023 15:22:12 +0100 Subject: [PATCH] Fix nullptr exception with invalid credentials --- src/AwsIotChannel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AwsIotChannel.cpp b/src/AwsIotChannel.cpp index 6e4ff8af..43ae8b5b 100644 --- a/src/AwsIotChannel.cpp +++ b/src/AwsIotChannel.cpp @@ -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 " +