From f2a99eda8c2ef96bb18b03990a254df2b6f139fc Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Wed, 15 Apr 2020 12:21:07 +0200
Subject: [PATCH] Allowing nullables
---
src/components/clickable_component.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/components/clickable_component.c b/src/components/clickable_component.c
index d92ac33..14bbbd0 100644
--- a/src/components/clickable_component.c
+++ b/src/components/clickable_component.c
@@ -20,6 +20,10 @@ static void ctr(void *component, va_list args)
if (!scene)
return;
+ if (onclick == NULL) {
+ cmp->onclick = NULL;
+ return;
+ }
callback = scene->get_callback(scene, onclick);
if (!callback)
my_printf("No callback found with the name: %s\n", onclick);
@@ -35,7 +39,7 @@ static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
if (!scene)
return;
callback = scene->get_callback(scene, onclick);
- if (!callback)
+ if (!callback && !xml_hasproperty(n, "nullable"))
my_printf("No callback found with the name: %s\n", onclick);
cmp->onclick = callback;
}