Skip to content

Commit

Permalink
Fixing null pointer exception if a stacktrace frame does not match th…
Browse files Browse the repository at this point in the history
…e expected format. Fixes issue 7977
  • Loading branch information
barancev committed Oct 27, 2014
1 parent 611fc48 commit d197b82
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions javascript/firefox-driver/js/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ fxdriver.error.toJSON = function(ex) {

for (var frame = stack.shift(); frame; frame = stack.shift()) {
var match = frame.match(/^([a-zA-Z_$][\w./<]*)?(?:\(.*\))?@(.+)?:(\d*)$/);
stackFrames.push({
'methodName': match[1],
'fileName': match[2],
'lineNumber': Number(match[3])
});
if (match) {
stackFrames.push({
'methodName': match[1],
'fileName': match[2],
'lineNumber': Number(match[3])
});
} else {
stackFrames.push({'methodName': frame});
}
}
}

Expand Down

0 comments on commit d197b82

Please sign in to comment.