Skip to content

Commit

Permalink
Merge pull request #81 from CYKEB/RegexFix
Browse files Browse the repository at this point in the history
Fixed bug in withNameRegex and firstWithNameRegex when name is null
  • Loading branch information
alexvollmer committed Nov 27, 2014
2 parents 94519f5 + be011c2 commit d8d73da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uiautomation-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extend(UIAElementArray.prototype, {
var ret = [];
for (var i = 0; i < this.length; ++i) {
var elem = this[i];
if (elem.isNotNil && elem.isNotNil() && elem.name().match(pattern) !== null) {
if (elem.isNotNil && elem.isNotNil() && elem.name() && elem.name().match(pattern) !== null) {
ret.push(elem);
}
}
Expand All @@ -48,7 +48,7 @@ extend(UIAElementArray.prototype, {
firstWithNameRegex: function(pattern) {
for (var i = 0; i < this.length; ++i) {
var elem = this[i];
if (elem.isNotNil && elem.isNotNil() && elem.name().match(pattern) !== null) return elem;
if (elem.isNotNil && elem.isNotNil() && elem.name() && elem.name().match(pattern) !== null) return elem;
}
return new UIAElementNil();
}
Expand Down

0 comments on commit d8d73da

Please sign in to comment.