Fix bugprone-unchecked-optional-access findings
Clang-tidy has the aforementioned check, which shows a few places in the
core where we ignored the required optional checks. Fix all uses.
Note, we cannot enable the check that this time because of some weird
code in health.hpp that crashes tidy[1]. That will need to be a future
improvement.
There are tests that call something like
ASSERT(optional)
EXPECT(optional->foo())
While this isn't an actual violation, clang-tidy doesn't seem to be
smart enough to deal with it, so add some explicit checks.
[1] https://github.com/llvm/llvm-project/issues/55530
Tested: Redfish service validator passes.
Change-Id: Ied579cd0b957efc81aff5d5d1091a740a7a2d7e3
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index a63b234..27df36e 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -154,8 +154,8 @@
completeResponseFields(thisReq, thisRes);
thisRes.addHeader(boost::beast::http::field::date, getCachedDateStr());
- boost::beast::http::fields& fields = thisRes.stringResponse->base();
- std::string code = std::to_string(thisRes.stringResponse->result_int());
+ boost::beast::http::fields& fields = thisRes.stringResponse.base();
+ std::string code = std::to_string(thisRes.stringResponse.result_int());
hdr.emplace_back(headerFromStringViews(":status", code));
for (const boost::beast::http::fields::value_type& header : fields)
{