Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Cannot set property ... of null (SG) #247

Closed
1 of 2 tasks
gc opened this issue Mar 24, 2018 · 0 comments · Fixed by #256
Closed
1 of 2 tasks

Cannot set property ... of null (SG) #247

gc opened this issue Mar 24, 2018 · 0 comments · Fixed by #256

Comments

@gc
Copy link
Contributor

gc commented Mar 24, 2018

Describe the issue

Error when trying to update a SG config of type 'any' with an object.

TypeError: Cannot set property 'test' of null

Code or steps to reproduce

  1. Get a raw app.js, only changing the token value - or skip to Step 4 if you have an unmodified bot running the latest klasa/d.js master that you can test on.

  2. Install Klasa, Discord Master:

    • npm i -S discordjs/discord.js
    • npm install dirigeants/klasa
    • npm install
  3. Run the bot.

  4. Add a key to your schema of type any:

+eval this.client.gateways.users.schema.add("test", { type: "any" })
  1. Update someones configs, in the test key, with an Object value.
+eval msg.author.configs.update("test", { test: 'test' });
  1. Reset the Object value in the test key of the users config.
+eval msg.author.configs.reset("test");
  1. Update the users config again, in the test key, with an Object value.
+eval msg.author.configs.update("test", { test: 'test' });
  1. Observe error: TypeError: Cannot set property 'test' of null. If the error doesn't appear, try rebooting the bot and trying it again.

Expected an actual behaviour

The test key in the users' configs should be updated with the Object value.

Further details

  • discord.js version: v12.0.0-dev
  • node.js version: v9.3.0
  • Klasa version: v0.5.0-dev
  • I have modified core files.
  • I have tested the issue on latest master. Commit hash:
@kyranet kyranet mentioned this issue Mar 29, 2018
4 tasks
@gc gc closed this as completed Apr 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant