K4AViewer: fix error message on uncoordinated captures (#241)

When starting the cameras without synchronized_images_only set, we were sometimes trying to get the image format of null images, which raised an error in the log. k4a_image_get_format returns K4A_IMAGE_FORMAT_CUSTOM in this case, which happened to never be what we were expecting to see, so the viewer dropped the image anyway, but with the addition of the new log pane, this became much more noticeable.

This adds a check to verify that the image is valid before trying to get its format, which prevents the error from being triggered.
This commit is contained in:
Billy Price 2019-04-15 11:40:54 -07:00 коммит произвёл GitHub
Родитель 7c53d66d50
Коммит 94cea8255c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -26,7 +26,7 @@ public:
template<k4a_image_format_t T> static k4a::image GetImageFromCapture(const k4a::capture &capture)
{
k4a::image img = capture.get_color_image();
if (img.get_format() != T)
if (!img || img.get_format() != T)
{
return k4a::image();
}