Added checks for snapshot

This commit is contained in:
Rene Zeldenthuis
2022-10-18 09:46:36 +02:00
parent 4acee4a82c
commit 68497a6c2c

View File

@@ -150,6 +150,12 @@ void handle_snapshot()
}
cam.run();
if (cam.getSize() == 0 || cam.getfb() == nullptr)
{
web_server.send(404, "text/plain", "Unable to obtain framebuffer");
return;
}
auto fb_len = cam.getSize();
auto fb = (const char *)memcpy(new uint8_t[fb_len], cam.getfb(), fb_len);
web_server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");