Skip to content

Commit d197b82

Browse files
committed
Fixing null pointer exception if a stacktrace frame does not match the expected format. Fixes issue 7977
1 parent 611fc48 commit d197b82

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Diff for: javascript/firefox-driver/js/error.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@ fxdriver.error.toJSON = function(ex) {
3838

3939
for (var frame = stack.shift(); frame; frame = stack.shift()) {
4040
var match = frame.match(/^([a-zA-Z_$][\w./<]*)?(?:\(.*\))?@(.+)?:(\d*)$/);
41-
stackFrames.push({
42-
'methodName': match[1],
43-
'fileName': match[2],
44-
'lineNumber': Number(match[3])
45-
});
41+
if (match) {
42+
stackFrames.push({
43+
'methodName': match[1],
44+
'fileName': match[2],
45+
'lineNumber': Number(match[3])
46+
});
47+
} else {
48+
stackFrames.push({'methodName': frame});
49+
}
4650
}
4751
}
4852

0 commit comments

Comments
 (0)