Skip to content

Commit fb54026

Browse files
author
Chris White
committed
Vivaldi: don't assume a tab was opened (#123)
This fix permits opening the settings page on Vivaldi.
1 parent 00e40e1 commit fb54026

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tabfern/src/view/const.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,19 @@
110110
})
111111
.then(function open_tab(done, new_win){
112112
win_id = new_win.id;
113-
tab0_id = new_win.tabs[0].id;
113+
// Chrome automatically creates a tab in a window, but
114+
// Vivaldi does not. Handle either.
115+
if(new_win.tabs && new_win.tabs.length) {
116+
tab0_id = new_win.tabs[0].id;
117+
}
114118
chrome.tabs.create({windowId: win_id, url: url}, ASQH.CC(done));
115119
})
116120
.then(function remove_old_tab(done){
117-
chrome.tabs.remove(tab0_id, ASQH.CC(done));
121+
if(tab0_id) {
122+
chrome.tabs.remove(tab0_id, ASQH.CC(done));
123+
} else {
124+
done();
125+
}
118126
})
119127
.or(function(err){log_orig.error({'Load error':err, url});})
120128
;

0 commit comments

Comments
 (0)