浏览代码

[ue4] Added missing null check in bone driver component. Closes #1517.

badlogic 6 年之前
父节点
当前提交
b4a1f6978b

二进制
spine-ue4/Content/GettingStarted/Blueprints/SpineboyHover_Blueprint.uasset


+ 2 - 2
spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp

@@ -40,7 +40,7 @@ void USpineBoneDriverComponent::BeginPlay () {
 }
 
 void USpineBoneDriverComponent::BeforeUpdateWorldTransform(USpineSkeletonComponent* skeleton) {	
-	if (skeleton == lastBoundComponent) {		
+	if (skeleton == lastBoundComponent && skeleton) {		
 		if (UseComponentTransform) {
 			skeleton->SetBoneWorldPosition(BoneName, GetComponentLocation());
 		}
@@ -56,7 +56,7 @@ void USpineBoneDriverComponent::TickComponent (float DeltaTime, ELevelTick TickT
 
 	if (Target) {
 		USpineSkeletonComponent* skeleton = static_cast<USpineSkeletonComponent*>(Target->GetComponentByClass(USpineSkeletonComponent::StaticClass()));
-		if (skeleton != lastBoundComponent) {
+		if (skeleton != lastBoundComponent && skeleton) {
 			// if (lastBoundComponent) lastBoundComponent->BeforeUpdateWorldTransform.RemoveAll(this);
 			if (!skeleton->BeforeUpdateWorldTransform.GetAllObjects().Contains(this))
 				skeleton->BeforeUpdateWorldTransform.AddDynamic(this, &USpineBoneDriverComponent::BeforeUpdateWorldTransform);