Skip to content

Commit 7e8652e

Browse files
committed
Fix missing exception when $magickBinaryPath fails
1 parent 269dcf3 commit 7e8652e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Command.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,17 @@ public static function findMagickBinaryPath(?string $magickBinaryPath): string
111111
$magickBinaryPath = (new ExecutableFinder())->find('magick');
112112
}
113113

114+
if (!$magickBinaryPath) {
115+
throw new MagickBinaryNotFoundException($magickBinaryPath);
116+
}
117+
114118
// Add a proper directory separator at the end if path is not empty.
115119
// If it's empty, then it's set in the global path.
116-
if ($magickBinaryPath && !\is_file($magickBinaryPath)) {
120+
if (!\is_file($magickBinaryPath)) {
117121
throw new MagickBinaryNotFoundException($magickBinaryPath);
118122
}
119123

120-
if ($magickBinaryPath && !\is_executable($magickBinaryPath)) {
124+
if (!\is_executable($magickBinaryPath)) {
121125
throw new \InvalidArgumentException(\sprintf('The specified script (%s) is not executable.', $magickBinaryPath));
122126
}
123127

0 commit comments

Comments
 (0)