make error check possible for xchat_get_plugin_pref_int

This commit is contained in:
Berke Viktor 2011-11-30 08:52:55 +01:00
parent ac4043dd9d
commit e488a0232a
1 changed files with 10 additions and 2 deletions

View File

@ -1735,6 +1735,7 @@ int
xchat_set_plugin_pref_int (xchat_plugin *pl, char *var, int value) xchat_set_plugin_pref_int (xchat_plugin *pl, char *var, int value)
{ {
char buffer[12]; char buffer[12];
sprintf (buffer, "%d", value); sprintf (buffer, "%d", value);
return xchat_set_plugin_pref_str (pl, var, buffer); return xchat_set_plugin_pref_str (pl, var, buffer);
} }
@ -1743,6 +1744,13 @@ int
xchat_get_plugin_pref_int (xchat_plugin *pl, char *var) xchat_get_plugin_pref_int (xchat_plugin *pl, char *var)
{ {
char buffer[12]; 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;
}
} }