From e488a0232a467b0b469a45f251b264f723380276 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 30 Nov 2011 08:52:55 +0100 Subject: [PATCH] make error check possible for xchat_get_plugin_pref_int --- src/common/plugin.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/plugin.c b/src/common/plugin.c index 56626865..d1493ccd 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -1735,6 +1735,7 @@ int xchat_set_plugin_pref_int (xchat_plugin *pl, char *var, int value) { char buffer[12]; + sprintf (buffer, "%d", value); return xchat_set_plugin_pref_str (pl, var, buffer); } @@ -1743,6 +1744,13 @@ int xchat_get_plugin_pref_int (xchat_plugin *pl, char *var) { char buffer[12]; - xchat_get_plugin_pref_str (pl, var, buffer); - return atoi (buffer); + + if (xchat_get_plugin_pref_str (pl, var, buffer)) + { + return atoi (buffer); + } + else + { + return -1; + } }