Skip to content

Commit cfc8ffe

Browse files
committed
subtle
1 parent 17ee8cf commit cfc8ffe

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎v4-cokapi/backends/javascript/jslogger.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,10 @@ function bar(x) {
326326
} else {
327327
// a true object
328328

329-
// if there's a custom toString() function
330-
var s = o.toString();
329+
// if there's a custom toString() function (note that a truly
330+
// prototypeless object won't have toString method, so check first to
331+
// see if toString is *anywhere* up the prototype chain)
332+
var s = (o.toString !== undefined) ? o.toString() : '';
331333
if (s !== '' && s !== '[object Object]') {
332334
newEncodedObj.push('INSTANCE_PPRINT', 'object', s);
333335
} else {

0 commit comments

Comments
 (0)