summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2011-11-30 08:52:55 +0100
committerBerke Viktor <berkeviktor@aol.com>2011-11-30 08:52:55 +0100
commite488a0232a467b0b469a45f251b264f723380276 (patch)
treebf243539352c860853916f53c606e8a23879a725 /src/common
parentac4043dd9d3f0549198977593ddcbba5039eae6d (diff)
make error check possible for xchat_get_plugin_pref_int
Diffstat (limited to 'src/common')
-rw-r--r--src/common/plugin.c12
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;
+	}
 }