Fix: url may be empty, so check it

This commit is contained in:
ilyaigpetrov 2019-10-25 16:09:29 +00:00
parent 74233d7fa8
commit bc2ceed1dc

View File

@ -75,11 +75,16 @@ export default function getExcEditor(theState) {
constructor(props) {
super(props);
const trimmedInputValueOrSpace =
props.currentTab &&
props.currentTab.url &&
!props.currentTab.url.startsWith('chrome')
? new URL(props.currentTab.url).hostname
: '';
const pacMods = props.apis.pacKitchen.getPacMods();
this.state = {
trimmedInputValueOrSpace:
props.currentTab && !props.currentTab.url.startsWith('chrome') ? new URL(props.currentTab.url).hostname : '',
trimmedInputValueOrSpace,
sortedListOfOptions: this.modsToOpts(pacMods),
isHostHidden: {}
};