libcamera: handle failure gracefully

Don't try to access NULL pointers
This commit is contained in:
Wim Taymans 2021-09-30 12:54:29 +02:00
parent f8817b4394
commit d71a10b7fa
3 changed files with 9 additions and 8 deletions

View file

@ -994,10 +994,10 @@ impl_init(const struct spa_handle_factory *factory,
port->dev.log = this->log;
port->dev.fd = -1;
if(port->dev.camera == NULL) {
if(port->dev.camera == NULL)
port->dev.camera = (LibCamera*)newLibCamera();
if(port->dev.camera != NULL)
libcamera_set_log(port->dev.camera, port->dev.log);
}
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_LIBCAMERA_PATH))) {
strncpy(this->props.device, str, 63);