From 5b21b661e02991fed5088eee0b45c817cb7cd418 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 14 Jan 2016 10:35:01 +0000 Subject: [PATCH] Added null check in ButtonClicked event handler --- Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs b/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs index 35ee6213..173fc5b2 100644 --- a/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs +++ b/Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs @@ -15,7 +15,10 @@ namespace Fungus public virtual void Start() { - targetButton.onClick.AddListener(OnButtonClick); + if (targetButton != null) + { + targetButton.onClick.AddListener(OnButtonClick); + } } protected virtual void OnButtonClick()