Skip to content

Commit

Permalink
Check for Controller::curr();
Browse files Browse the repository at this point in the history
It is nog a fact that there is always a Controller on the command line
  • Loading branch information
axyr committed Apr 16, 2016
1 parent af2147f commit 25acf80
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions code/Extensions/Annotatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ public function requireDefaultRecords()
// Setup the protected values.
$this->setUp();

/** @var SS_HTTPRequest|NullHTTPRequest $request */
$request = Controller::curr()->getRequest();
$skipAnnotation = $request->getVar('skipannotation');
$skipAnnotation = null;

// This is not the case on the command line
if(Controller::has_curr()) {
$skipAnnotation = Controller::curr()->getRequest()->getVar('skipannotation');
}

if ($skipAnnotation !== null || !$this->permissionChecker->environmentIsAllowed()) {
return false;
}
Expand Down

0 comments on commit 25acf80

Please sign in to comment.