Skip to content

Commit 3d89da8

Browse files
committed
Add sanity check to service
1 parent b4ca509 commit 3d89da8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/GeoIP.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public function getCurrency($iso)
189189
* Get service instance.
190190
*
191191
* @return \Torann\GeoIP\Contracts\ServiceInterface
192+
* @throws Exception
192193
*/
193194
public function getService()
194195
{
@@ -199,6 +200,11 @@ public function getService()
199200
// Get service class
200201
$class = Arr::pull($config, 'class');
201202

203+
// Sanity check
204+
if ($class === null) {
205+
throw new Exception('The GeoIP service is not valid.');
206+
}
207+
202208
// Create service instance
203209
$this->service = app($class, [$config]);
204210
}

0 commit comments

Comments
 (0)