Skip to content

Commit

Permalink
Checking types before calling methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 29, 2011
1 parent cff980b commit 168c6f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/View/JsonView.php
Expand Up @@ -63,8 +63,8 @@ class JsonView extends View {
*/
public function __construct($controller) {
parent::__construct($controller);
if (is_object($controller)) {
$this->response->type('json');
if (isset($controller->response) && $controller->response instanceof CakeResponse) {
$controller->response->type('json');
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/XmlView.php
Expand Up @@ -66,7 +66,7 @@ class XmlView extends View {
public function __construct($controller) {
parent::__construct($controller);

if (is_object($controller)) {
if (isset($controller->response) && $controller->response instanceof CakeResponse) {
$controller->response->type('xml');
}
}
Expand Down

0 comments on commit 168c6f1

Please sign in to comment.