Skip to content

Commit b7f3c96

Browse files
committed
Add missing null check
Fixes #1
1 parent 6d26d5d commit b7f3c96

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Webcam.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function close(): void
5252

5353
public function saveFrame(string $filename): bool
5454
{
55+
if ($this->cvCamera === null) {
56+
return false;
57+
}
58+
5559
return (bool) $this->ffi->cvSaveImage($filename, $this->ffi->cvQueryFrame($this->cvCamera));
5660
}
5761
}

0 commit comments

Comments
 (0)