fix currentRoute() when $_currentRoute is empty, return false

This commit is contained in:
Saleh Souzanchi 2013-04-26 09:09:40 +04:30
parent 509b2b1e44
commit 720dc5e8c0

View file

@ -1093,7 +1093,8 @@ class Router {
* @return CakeRoute Matching route object.
*/
public static function currentRoute() {
return self::$_currentRoute[count(self::$_currentRoute) - 1];
$count = count(self::$_currentRoute) - 1;
return ($count >= 0) ? self::$_currentRoute[$count] : false;
}
/**