You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When activating dictation and then exiting play before the Wit service provides any transcription output, UWitRequestSubsystem::OnRequestComplete is called with a null value for Response. This causes a crash when Response is then dereferenced on line 368 of WitRequestSubsystem.cpp. This issue occurs on at least UE 5.3.
After checking if the HTTP request was unsuccessful, you should also check that Response is valid in order to safely issue an HTTP error message referencing its response code.
Original code:
/** * Called when an HTTP request is fully completed to process the response payload * * @param Request the completed request * @param Response the full and final response * @param bIsSuccessful whether the request successfully completed*/voidUWitRequestSubsystem::OnRequestComplete(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bIsSuccessful)
{
HttpRequest = nullptr;
if (!bIsSuccessful)
{
const FString ErrorMessage = FString::Format(TEXT("HTTP Error {0}"), { Response->GetResponseCode()});
const FString HumanReadableErrorMessage = FString::Format(TEXT("Request failed with error code {0}"), { Response->GetResponseCode()});
Configuration.OnRequestError.Broadcast(ErrorMessage, HumanReadableErrorMessage);
return;
}
Proposed code (excluding any other desired error message for this case):
/** * Called when an HTTP request is fully completed to process the response payload * * @param Request the completed request * @param Response the full and final response * @param bIsSuccessful whether the request successfully completed*/voidUWitRequestSubsystem::OnRequestComplete(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bIsSuccessful)
{
HttpRequest = nullptr;
if (!bIsSuccessful)
{
if (Response)
{
const FString ErrorMessage = FString::Format(TEXT("HTTP Error {0}"), { Response->GetResponseCode()});
const FString HumanReadableErrorMessage = FString::Format(TEXT("Request failed with error code {0}"), { Response->GetResponseCode()});
Configuration.OnRequestError.Broadcast(ErrorMessage, HumanReadableErrorMessage);
}
return;
}
The text was updated successfully, but these errors were encountered:
EvanMcRae
added a commit
to EvanMcRae/wit-unreal
that referenced
this issue
Feb 18, 2025
When activating dictation and then exiting play before the Wit service provides any transcription output,
UWitRequestSubsystem::OnRequestComplete
is called with a null value forResponse
. This causes a crash whenResponse
is then dereferenced on line 368 ofWitRequestSubsystem.cpp
. This issue occurs on at least UE 5.3.After checking if the HTTP request was unsuccessful, you should also check that
Response
is valid in order to safely issue an HTTP error message referencing its response code.Original code:
Proposed code (excluding any other desired error message for this case):
The text was updated successfully, but these errors were encountered: