diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-15 08:35:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-15 08:35:41 +0300 |
commit | 4bea4702d5d5a9feb4f06c4d9f09834dc4a278a1 (patch) | |
tree | 61ed6979b70aa31f24ca1c93124ee6d8597e1b7d /intern/cycles/blender/blender_python.cpp | |
parent | c0dde8be8438ebc35fe5d4498e903bdbdb34a9a8 (diff) |
PyAPI: throw exception when cycles is given an invalid device name
Diffstat (limited to 'intern/cycles/blender/blender_python.cpp')
-rw-r--r-- | intern/cycles/blender/blender_python.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 65337d1ba4f..021985bd2ba 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -410,6 +410,11 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject *args) } DeviceType type = Device::type_from_string(type_name); + if ((type == DEVICE_NONE) && (type_name[0] != '\0')) { + PyErr_Format(PyExc_ValueError, "Device \"%s\" not known.", type_name); + return NULL; + } + uint mask = (type == DEVICE_NONE) ? DEVICE_MASK_ALL : DEVICE_MASK(type); mask |= DEVICE_MASK_CPU; |