Skip to content

Commit 896215e

Browse files
authored
Merge pull request #11 from GitHubHubus/master
Fixed exception in constructor when using invalid file name
2 parents 14bb343 + 6b4b763 commit 896215e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Jsonq.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ public function __construct($jsonFile = null)
2626
{
2727
if (!is_null($jsonFile)) {
2828
$path = pathinfo($jsonFile);
29-
30-
if ($path['extension'] != 'json') {
29+
$extansion = isset($path['extension']) ? $path['extension'] : null;
30+
31+
if ($extansion != 'json') {
3132
throw new InvalidJsonException();
3233
}
33-
}
34-
35-
if (!is_null($jsonFile) && isset($path['extension'])) {
34+
3635
$this->import($jsonFile);
3736
}
3837
}

0 commit comments

Comments
 (0)