From c6f0c377bea4ca8a381ca4775116f6559d9df075 Mon Sep 17 00:00:00 2001
From: Ny Bruker <robinhs@stud.ntnu.no>
Date: Thu, 10 Nov 2022 20:45:29 +0100
Subject: [PATCH] Fixed error with audio source.

---
 MrBigsock/Assets/Code/Character.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MrBigsock/Assets/Code/Character.cs b/MrBigsock/Assets/Code/Character.cs
index 5e263ce6..a355487f 100644
--- a/MrBigsock/Assets/Code/Character.cs
+++ b/MrBigsock/Assets/Code/Character.cs
@@ -217,7 +217,7 @@ namespace BigSock {
 			// Trigger the event for taking damage.
 			OnTakeDamage?.Invoke(this, attack.Actor, attack);
 
-			if (TakeDamageAudio != null){
+			if(TakeDamageAudio != null && source?.Count > 0 && source[0] != null) {
 				source[0].clip = TakeDamageAudio;
 				source[0].Play();
 			}
-- 
GitLab