Meteor roles runs into TypeError


I filed this issue with meteor roles.

It appears that the client can have at some stage a roles object like so:

roles [
    "_id": "xmWydv4ArwHv5wggF"

Note it does not have a ‘inheritedRoles’ field nor a ‘role’ field.

This cause line 780 (see below) in roles_common.js to bomb out with a TypeError: r is undefined

  return [ Set(
        .map(r => r.inheritedRoles || [r.role])
        .reduce((rev, current) => rev.concat(current), [])
        .map(r => r._id)

Any advice as to what I could be doing wrong or how to work around the issue?