From 98824e94ded4e1b90a5b221084c89cb00a705823 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 9 Dec 2013 07:06:15 +0000 Subject: [PATCH] Themes: Avoid a JS error in the keyup event handler when the overlay is not yet initialized. fixes #26497. git-svn-id: https://develop.svn.wordpress.org/trunk@26826 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/theme.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-admin/js/theme.js b/src/wp-admin/js/theme.js index ba1f7fd1ad..02d335ed17 100644 --- a/src/wp-admin/js/theme.js +++ b/src/wp-admin/js/theme.js @@ -390,6 +390,10 @@ themes.view.Themes = wp.Backbone.View.extend({ // Bind keyboard events. $('body').on( 'keyup', function( event ) { + if ( ! self.overlay ) { + return; + } + // Pressing the right arrow key fires a theme:next event if ( event.keyCode === 39 ) { self.overlay.nextTheme();