fix #506: auto-type for empty window title

This commit is contained in:
antelle 2017-02-05 08:54:01 +01:00
parent 7cd93c0b6b
commit 41c40bc86e
1 changed files with 2 additions and 2 deletions

View File

@ -32,13 +32,13 @@ AutoTypeHelper.prototype.getActiveWindowTitle = function(callback) {
AutoTypeHelper.exec(ChromeScript.replace(/\{}/g, appName), (err, out) => {
if (err) { return callback(err); }
const parts = out.split('\n');
return callback(null, parts[1].trim(), parts[0].trim());
return callback(null, (parts[1] || '').trim(), parts[0].trim());
});
} else if (['Safari', 'Webkit'].indexOf(appName) >= 0) {
AutoTypeHelper.exec(SafariScript.replace(/\{}/g, appName), (err, out) => {
if (err) { return callback(err); }
const parts = out.split('\n');
return callback(null, parts[1].trim(), parts[0].trim());
return callback(null, (parts[1] || '').trim(), parts[0].trim());
});
} else {
// special cases are not available. this method may ask the user about assistive access