python: Fix get_pluginpref()

This relied on undocumented behavior of hexchat_pluginpref_get_int()
that has been fixed recently. -1 is the correct failure value.
This commit is contained in:
Patrick Griffis 2016-08-05 21:08:52 -04:00
parent 034624983b
commit 9d74ceedfd

View File

@ -1849,7 +1849,7 @@ Module_hexchat_pluginpref_get(PyObject *self, PyObject *args)
BEGIN_XCHAT_CALLS(NONE); BEGIN_XCHAT_CALLS(NONE);
retint = hexchat_pluginpref_get_int(prefph, var); retint = hexchat_pluginpref_get_int(prefph, var);
END_XCHAT_CALLS(); END_XCHAT_CALLS();
if ((retint == 0) && (strcmp(retstr, "0") != 0)) if ((retint == -1) && (strcmp(retstr, "-1") != 0))
ret = PyUnicode_FromString(retstr); ret = PyUnicode_FromString(retstr);
else else
ret = PyLong_FromLong(retint); ret = PyLong_FromLong(retint);