Fix #107261: bpy.types.Text (region_as_string/region_from_string) crash

These two didnt check if keywords were passed in, crashed on running
`PyDict_GET_SIZE` on NULL (in case of no keywords).

Oversight in ee292a1d66.

Now just check if keywords are actually passed in.

Pull Request: blender/blender#107285
This commit is contained in:
2023-04-24 11:48:22 +02:00
committed by Philipp Oeser
parent ca32fb604e
commit e4afa06dab

View File

@@ -75,7 +75,7 @@ static PyObject *bpy_rna_region_as_string(PyObject *self, PyObject *args, PyObje
return NULL;
}
if (PyDict_GET_SIZE(kwds) > 0) {
if (kwds && PyDict_GET_SIZE(kwds) > 0) {
txt_sel_set(text, region.curl, region.curc, region.sell, region.selc);
}
@@ -140,7 +140,7 @@ static PyObject *bpy_rna_region_from_string(PyObject *self, PyObject *args, PyOb
return NULL;
}
if (PyDict_GET_SIZE(kwds) > 0) {
if (kwds && PyDict_GET_SIZE(kwds) > 0) {
txt_sel_set(text, region.curl, region.curc, region.sell, region.selc);
}