Adding some missing safety checks to the voice library functions.

Former-commit-id: 8cd15bd34f83bd2827c6672a24b5203bd2c2557b
This commit is contained in:
mordentral
2017-04-20 14:32:46 -04:00
parent 3942e22147
commit f994b22cf2
2 changed files with 45 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ void UAdvancedIdentityLibrary::GetPlayerAuthToken(APlayerController * PlayerCont
Result = EBlueprintResultSwitch::OnFailure;
return;
}
AuthToken = IdentityInterface->GetAuthToken(Player->GetControllerId());
Result = EBlueprintResultSwitch::OnSuccess;
}
@@ -57,7 +57,7 @@ void UAdvancedIdentityLibrary::GetPlayerNickname(const FBPUniqueNetId & UniqueNe
void UAdvancedIdentityLibrary::GetLoginStatus(const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result)
{
if(!UniqueNetID.IsValid())
if (!UniqueNetID.IsValid())
{
UE_LOG(AdvancedIdentityLog, Warning, TEXT("GetLoginStatus was passed a bad player uniquenetid!"));
Result = EBlueprintResultSwitch::OnFailure;
@@ -103,6 +103,13 @@ void UAdvancedIdentityLibrary::GetUserAccount(const FBPUniqueNetId & UniqueNetId
{
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
if(!UniqueNetId.IsValid())
{
UE_LOG(AdvancedIdentityLog, Warning, TEXT("GetUserAccount was passed a bad unique net id!"));
Result = EBlueprintResultSwitch::OnFailure;
return;
}
if (!IdentityInterface.IsValid())
{
UE_LOG(AdvancedIdentityLog, Warning, TEXT("GetUserAccount Failed to get identity interface!"));

View File

@@ -100,6 +100,12 @@ void UAdvancedVoiceLibrary::UnRegisterAllLocalTalkers()
bool UAdvancedVoiceLibrary::RegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedVoiceLog, Warning, TEXT("Register Remote Talker was passed an invalid unique net id!"));
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
if (!VoiceInterface.IsValid())
@@ -113,6 +119,12 @@ bool UAdvancedVoiceLibrary::RegisterRemoteTalker(const FBPUniqueNetId& UniqueNet
bool UAdvancedVoiceLibrary::UnRegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedVoiceLog, Warning, TEXT("UnRegister Remote Talker was passed an invalid unique net id!"));
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
if (!VoiceInterface.IsValid())
@@ -152,6 +164,12 @@ bool UAdvancedVoiceLibrary::IsLocalPlayerTalking(uint8 LocalPlayerNum)
bool UAdvancedVoiceLibrary::IsRemotePlayerTalking(const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedVoiceLog, Warning, TEXT("Is Remote Player Talking was passed an invalid unique net id!"));
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
if (!VoiceInterface.IsValid())
@@ -165,6 +183,12 @@ bool UAdvancedVoiceLibrary::IsRemotePlayerTalking(const FBPUniqueNetId& UniqueNe
bool UAdvancedVoiceLibrary::IsPlayerMuted(uint8 LocalUserNumChecking, const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedVoiceLog, Warning, TEXT("Is Player Muted was passed an invalid unique net id!"));
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
if (!VoiceInterface.IsValid())
@@ -178,6 +202,12 @@ bool UAdvancedVoiceLibrary::IsPlayerMuted(uint8 LocalUserNumChecking, const FBPU
bool UAdvancedVoiceLibrary::MuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide)
{
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedVoiceLog, Warning, TEXT("Mute Remote Talker was passed an invalid unique net id!"));
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
if (!VoiceInterface.IsValid())
@@ -191,6 +221,12 @@ bool UAdvancedVoiceLibrary::MuteRemoteTalker(uint8 LocalUserNum, const FBPUnique
bool UAdvancedVoiceLibrary::UnMuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide)
{
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedVoiceLog, Warning, TEXT("Unmute Remote Talker was passed an invalid unique net id!"));
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
if (!VoiceInterface.IsValid())