fixed Chromium API complaining of invalid tabId

This commit is contained in:
gorhill 2015-04-12 18:32:35 -04:00
parent 4023d0cd84
commit 2cc5fb3b19
1 changed files with 3 additions and 0 deletions

View File

@ -208,6 +208,9 @@ vAPI.tabs.get = function(tabId, callback) {
if ( typeof tabId === 'string' ) { if ( typeof tabId === 'string' ) {
tabId = parseInt(tabId, 10); tabId = parseInt(tabId, 10);
} }
if ( typeof tabId !== 'number' || isNaN(tabId) ) {
onTabReady(null);
}
chrome.tabs.get(tabId, onTabReady); chrome.tabs.get(tabId, onTabReady);
return; return;
} }