fix python's get_pluginpref crashing on long strings
This commit is contained in:
parent
b5f78f484d
commit
d1e2048239
|
@ -1610,12 +1610,15 @@ Module_hexchat_pluginpref_get(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "s:get_pluginpref", &var))
|
||||
return NULL;
|
||||
// This will always return numbers as integers.
|
||||
retint = hexchat_pluginpref_get_int(ph, var);
|
||||
if (hexchat_pluginpref_get_str(ph, var, retstr)) {
|
||||
if (strlen (retstr) <= 12) {
|
||||
retint = hexchat_pluginpref_get_int(ph, var);
|
||||
if ((retint == 0) && (strcmp(retstr, "0") != 0))
|
||||
ret = PyString_FromString(retstr);
|
||||
else
|
||||
ret = PyInt_FromLong(retint);
|
||||
} else
|
||||
ret = PyString_FromString(retstr);
|
||||
}
|
||||
else
|
||||
ret = Py_None;
|
||||
|
|
Loading…
Reference in New Issue