Make sure the queried object is non-null before accessing its properties.

Props markoheijnen, ryan.
Fixes #21394.



git-svn-id: https://develop.svn.wordpress.org/trunk@25310 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-10 02:27:24 +00:00
parent d0a189c6be
commit 14e44dcd05
4 changed files with 30 additions and 16 deletions

View File

@@ -256,7 +256,8 @@ function get_page_template() {
if ( ! $pagename && $id ) {
// If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
$post = get_queried_object();
$pagename = $post->post_name;
if ( $post )
$pagename = $post->post_name;
}
$templates = array();