summaryrefslogtreecommitdiff
path: root/src/plugins/trigger/trigger-callback.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2014-02-22 17:10:35 +0100
committerSebastien Helleu <flashcode@flashtux.org>2014-02-22 17:10:35 +0100
commitc3775888bde7ab3be5cd256615af4780bc137a75 (patch)
tree402e7ff7ef4133e3a0b6b91f7194a2a07851499c /src/plugins/trigger/trigger-callback.c
parent0c3835d82470f7dff15fd6ece6f7ded0520e3419 (diff)
downloadweechat-c3775888bde7ab3be5cd256615af4780bc137a75.zip
trigger: fix crash when a signal is received with type "int" and NULL pointer in signal_data
Diffstat (limited to 'src/plugins/trigger/trigger-callback.c')
-rw-r--r--src/plugins/trigger/trigger-callback.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c
index a0bc08791..6dbff9874 100644
--- a/src/plugins/trigger/trigger-callback.c
+++ b/src/plugins/trigger/trigger-callback.c
@@ -392,8 +392,12 @@ trigger_callback_signal_cb (void *data, const char *signal,
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
- snprintf (str_data, sizeof (str_data),
- "%d", *((int *)signal_data));
+ str_data[0] = '\0';
+ if (signal_data)
+ {
+ snprintf (str_data, sizeof (str_data),
+ "%d", *((int *)signal_data));
+ }
ptr_signal_data = str_data;
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)