diff options
author | Berke Viktor <berkeviktor@aol.com> | 2011-11-30 08:52:55 +0100 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2011-11-30 08:52:55 +0100 |
commit | e488a0232a467b0b469a45f251b264f723380276 (patch) | |
tree | bf243539352c860853916f53c606e8a23879a725 | |
parent | ac4043dd9d3f0549198977593ddcbba5039eae6d (diff) |
make error check possible for xchat_get_plugin_pref_int
-rw-r--r-- | src/common/plugin.c | 12 |
1 files 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; + } } |