Check handle before using it

pull/37/head
Varun Patil 2022-08-20 02:10:15 +00:00
parent 83f4db77e8
commit 42b0a82e3f
1 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,10 @@ class Util {
*/ */
public static function getExifFromFile(File &$file) { public static function getExifFromFile(File &$file) {
$handle = $file->fopen('rb'); $handle = $file->fopen('rb');
if (!$handle) {
throw new \Exception('Could not open file');
}
$exif = self::getExifFromStream($handle); $exif = self::getExifFromStream($handle);
fclose($handle); fclose($handle);
return $exif; return $exif;