Hi,
I investigated a NullReferenceException being thrown in ItemEquipVerifier's ShouldBlockAbilityStart and ShouldStopActiveAbility.
The problem only occurs for synced Characters (the ones where CharacterLocomotion is disabled).
The Callstack leading to the error is like this
PunCharacter.OnAbilityActiveRPC()
UltimateCharacterLocomotion.TryStartAbility()
ItemEquipVerifier.ShouldBlockAbilityStart()
ItemEquipVerifier.ShouldStopActiveAbility()
In ShouldBlockAbilityStart / ShouldStopActiveAbility, m_StartingAbility is null because the ability is not "really running" on synced characters. It should be safe to just check if m_StartingAbility is null and return false to fix this problem like below or?
ItemEquipVerifier:231
Thanks!
I investigated a NullReferenceException being thrown in ItemEquipVerifier's ShouldBlockAbilityStart and ShouldStopActiveAbility.
The problem only occurs for synced Characters (the ones where CharacterLocomotion is disabled).
The Callstack leading to the error is like this
PunCharacter.OnAbilityActiveRPC()
UltimateCharacterLocomotion.TryStartAbility()
ItemEquipVerifier.ShouldBlockAbilityStart()
ItemEquipVerifier.ShouldStopActiveAbility()
In ShouldBlockAbilityStart / ShouldStopActiveAbility, m_StartingAbility is null because the ability is not "really running" on synced characters. It should be safe to just check if m_StartingAbility is null and return false to fix this problem like below or?
ItemEquipVerifier:231
Code:
public override bool ShouldBlockAbilityStart(Ability startingAbility)
{
// GUNFU:HACK prevent null deref in multiplayer mode
if (m_StartingAbility == null) {
return false;
}
return m_StartingAbility.ShouldBlockAbilityStart(startingAbility) || m_StartingAbility.Index < startingAbility.Index;
}
/// <summary>
/// Called when the current ability is attempting to start and another ability is active.
/// Returns true or false depending on if the active ability should be stopped.
/// </summary>
/// <param name="activeAbility">The ability that is currently active.</param>
/// <returns>True if the ability should be stopped.</returns>
public override bool ShouldStopActiveAbility(Ability activeAbility)
{
if (m_StartingAbility == null) {
return false;
}
return m_StartingAbility.ShouldStopActiveAbility(activeAbility) || m_StartingAbility.Index < activeAbility.Index;
}
Thanks!