ssbc / ssb-tribes

GNU Lesser General Public License v3.0
26 stars 4 forks source link

Cannot read property 'text' of null #13

Open christianbundy opened 4 years ago

christianbundy commented 4 years ago

I tried running invite(groupId, inviteList, null) and my null was treated like an object.

Workaround: Pass empty object.

    not ok 11 - Cannot read property 'text' of null
      ---
      stack: |
        groupInvite (node_modules/ssb-tribes/method/group/add-member.js:26:14)
        Timeout._onTimeout (node_modules/ssb-tribes/method/index.js:21:54)
      at:
        line: 26
        column: 14
        file: node_modules/ssb-tribes/method/group/add-member.js
        function: groupInvite
      type: TypeError
      tapCaught: uncaughtException
      test: async
      source: |2

            if (opts.text) content.text = opts.text
        -------------^

            if (!isValid(content)) return cb(new Error(isValid.errorsString))
      ...
mixmix commented 4 years ago

hmmm why you put null in there?

christianbundy commented 4 years ago

I wanted to pass a callback but I didn't want to pass opts. I suppose I could've passed undefined or {}, but usually I'd expect that you could pass null there too. :shrug: Very possible that my expectation is Wrong.

mixmix commented 4 years ago

my ideal is to change all the functions so opts can just straight be left out .... as if it's opts it's optional?