Checking types before calling methods.

This commit is contained in:
mark_story 2011-11-28 21:36:13 -05:00
parent cff980b45d
commit 168c6f14c2
2 changed files with 3 additions and 3 deletions

View file

@ -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');
}
}

View file

@ -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');
}
}