Raise an error on negative scroll amounts

This commit is contained in:
Kovid Goyal 2017-09-10 12:29:36 +05:30
parent 2490199e52
commit 19bd068599
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1336,7 +1336,10 @@ scroll(Screen *self, PyObject *args) {
amt = self->historybuf->count;
break;
default:
amt = MAX(0, amt);
if (amt < 0) {
PyErr_SetString(PyExc_ValueError, "scroll amounts must be positive numbers");
return NULL;
}
break;
}
if (!upwards) {