In wp.updates.decrementCount(), only display the count if it's a valid non-negative integer.

props jdgrimes.
fixes #29527.

git-svn-id: https://develop.svn.wordpress.org/trunk@29960 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-10-18 19:54:40 +00:00
parent d7955317f3
commit 0caa0b1dbf
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ window.wp = window.wp || {};
$elem = $( '#wp-admin-bar-updates .ab-label' );
count = $elem.text();
count = parseInt( count, 10 ) - 1;
if ( count < 0 ) {
if ( count < 0 || isNaN( count ) ) {
return;
}
$( '#wp-admin-bar-updates .ab-item' ).removeAttr( 'title' );
@ -32,7 +32,7 @@ window.wp = window.wp || {};
$elem = $( '#menu-plugins' );
pluginCount = $elem.find( '.plugin-count' ).eq(0).text();
pluginCount = parseInt( pluginCount, 10 ) - 1;
if ( pluginCount < 0 ) {
if ( pluginCount < 0 || isNaN( pluginCount ) ) {
return;
}
$elem.find( '.plugin-count' ).text( pluginCount );