Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-10-15 08:35:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-15 08:35:41 +0300
commit4bea4702d5d5a9feb4f06c4d9f09834dc4a278a1 (patch)
tree61ed6979b70aa31f24ca1c93124ee6d8597e1b7d /intern
parentc0dde8be8438ebc35fe5d4498e903bdbdb34a9a8 (diff)
PyAPI: throw exception when cycles is given an invalid device name
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_python.cpp5
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;