From 3446bc6337eab28494be38d30cabb4b5e79af3b8 Mon Sep 17 00:00:00 2001 From: Bradley Friedman Date: Fri, 27 Aug 2021 00:57:14 -0400 Subject: [PATCH] [bugfix] [cpp-ue4] API often tries to set reference to null when calling GetHttpRetryManager (#10277) * [cpp-ue4] implemented null check and fatal log for GetHttpRetryManager] * [cpp-ue4] reimplemented null check as checkf rather than Fatail UE_LOG * [cpp-ue4] regenerated samples and docs --- .../src/main/resources/cpp-ue4/api-source.mustache | 1 + samples/client/petstore/cpp-ue4/Private/OpenAPIPetApi.cpp | 1 + samples/client/petstore/cpp-ue4/Private/OpenAPIStoreApi.cpp | 1 + samples/client/petstore/cpp-ue4/Private/OpenAPIUserApi.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache index d2821b2daaa..8d0efb6a1d9 100644 --- a/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache @@ -56,6 +56,7 @@ void {{classname}}::SetHttpRetryManager(FHttpRetrySystem::FManager& InRetryManag FHttpRetrySystem::FManager& {{classname}}::GetHttpRetryManager() { + checkf(RetryManager, TEXT("{{classname}}: RetryManager is null. You may have meant to set it with SetHttpRetryManager first, or you may not be using a custom RetryManager at all.")) return *RetryManager; } diff --git a/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApi.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApi.cpp index ec0444e643c..3e52679fc3e 100644 --- a/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApi.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApi.cpp @@ -65,6 +65,7 @@ void OpenAPIPetApi::SetHttpRetryManager(FHttpRetrySystem::FManager& InRetryManag FHttpRetrySystem::FManager& OpenAPIPetApi::GetHttpRetryManager() { + checkf(RetryManager, TEXT("OpenAPIPetApi: RetryManager is null. You may have meant to set it with SetHttpRetryManager first, or you may not be using a custom RetryManager at all.")) return *RetryManager; } diff --git a/samples/client/petstore/cpp-ue4/Private/OpenAPIStoreApi.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIStoreApi.cpp index 1c5935b0867..04ee754d255 100644 --- a/samples/client/petstore/cpp-ue4/Private/OpenAPIStoreApi.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIStoreApi.cpp @@ -65,6 +65,7 @@ void OpenAPIStoreApi::SetHttpRetryManager(FHttpRetrySystem::FManager& InRetryMan FHttpRetrySystem::FManager& OpenAPIStoreApi::GetHttpRetryManager() { + checkf(RetryManager, TEXT("OpenAPIStoreApi: RetryManager is null. You may have meant to set it with SetHttpRetryManager first, or you may not be using a custom RetryManager at all.")) return *RetryManager; } diff --git a/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApi.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApi.cpp index 55b34981cb5..cc231f0be31 100644 --- a/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApi.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApi.cpp @@ -65,6 +65,7 @@ void OpenAPIUserApi::SetHttpRetryManager(FHttpRetrySystem::FManager& InRetryMana FHttpRetrySystem::FManager& OpenAPIUserApi::GetHttpRetryManager() { + checkf(RetryManager, TEXT("OpenAPIUserApi: RetryManager is null. You may have meant to set it with SetHttpRetryManager first, or you may not be using a custom RetryManager at all.")) return *RetryManager; }