diff --git a/Source/ConfigCat/Private/ConfigCatSubsystem.cpp b/Source/ConfigCat/Private/ConfigCatSubsystem.cpp index 87de149..0d6224b 100644 --- a/Source/ConfigCat/Private/ConfigCatSubsystem.cpp +++ b/Source/ConfigCat/Private/ConfigCatSubsystem.cpp @@ -283,12 +283,18 @@ bool UConfigCatSubsystem::IsOffline() const void UConfigCatSubsystem::Initialize(FSubsystemCollectionBase& Collection) { - const FString CppSdkVersion = UTF8_TO_TCHAR(configcat::version); - UE_LOG(LogConfigCat, Display, TEXT("ConfigCat Subsystem initializing cpp-sdk - %s"), *CppSdkVersion); - const UConfigCatSettings* ConfigCatSettings = GetDefault(); + if(!ConfigCatSettings || ConfigCatSettings->SdkKey.IsEmpty()) + { + UE_LOG(LogConfigCat, Warning, TEXT("Empty SdkKey detected. Please set your SdkKey in the Project Settings.")); + return; + } + const std::string& SdkKey = TCHAR_TO_UTF8(*ConfigCatSettings->SdkKey); + const FString CppSdkVersion = UTF8_TO_TCHAR(configcat::version); + UE_LOG(LogConfigCat, Display, TEXT("ConfigCat Subsystem initializing cpp-sdk - %s"), *CppSdkVersion); + ConfigCatOptions Options; Options.baseUrl = TCHAR_TO_UTF8(*ConfigCatSettings->BaseUrl); Options.dataGovernance = ConfigCatSettings->DataGovernance == EDataGovernance::Global ? Global : EuOnly;