PyAPI: throw exception when cycles is given an invalid device name
This commit is contained in:
parent
c0dde8be84
commit
4bea4702d5
Notes:
blender-bot
2023-02-14 09:03:55 +01:00
Referenced by commit 4d9f357bf6
, Fix T81806: Cycles error when GPU device_type is NONE
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue