Fix a null error for _defaultAction in ChromeTabs.

This commit is contained in:
FelisCatus 2015-02-04 12:17:58 +08:00
parent 49d434b481
commit 6e7b5150c1

View File

@ -40,8 +40,9 @@ class ChromeTabs
try chrome.browserAction.setBadgeText(text: '', tabId: id) try chrome.browserAction.setBadgeText(text: '', tabId: id)
@_badgeTab = null @_badgeTab = null
if not tab.url? or tab.url.indexOf("chrome") == 0 if not tab.url? or tab.url.indexOf("chrome") == 0
chrome.browserAction.setTitle(title: @_defaultAction.title, tabId: tab.id) if @_defaultAction
@clearIcon tab.id chrome.browserAction.setTitle(title: @_defaultAction.title, tabId: tab.id)
@clearIcon tab.id
return return
@actionForUrl(tab.url).then (action) => @actionForUrl(tab.url).then (action) =>
@setIcon(action.icon, tab.id) @setIcon(action.icon, tab.id)