Error with locking and unlocking variables - evaluating variable: Cannot read properties of null (reading 'tok')

6 views
Skip to first unread message

Ben Brawn

unread,
Sep 29, 2022, 2:21:36 AM9/29/22
to Numbas Users
There is a bug with locking and unlocking variables in the editor.

Here are the steps to reproduce the issue (don't do it on a question you like!) 
  1. click the padlock to lock a variable
  2. unclick the padlock to unlock a variable
Note
  1. now in the editor the table has nothing in 'type' and 'generated value'
  2. interestingly the question will still run (including any randomiation of that variable)
  3. deleting the variable and reusing the same name doesn't solve the issue 
  4. if you make a new variable, say blah, that depends on the now dodgy variable you will get the error "Error evaluating variable blah: Cannot read properties of null (reading 'tok')"

Ben Brawn

unread,
Sep 29, 2022, 2:31:38 AM9/29/22
to Numbas Users
Unexpectedly (for me), if you close the question and reopen it, then it works again.

Ben Brawn

unread,
Sep 29, 2022, 2:34:24 AM9/29/22
to Numbas Users
Oh and I missed two steps in producing the bug, looks like you need to click "regenerate values" while the padlock is on and then click "regenerate values" once you turn the padlock off.

Christian Lawson-Perfect

unread,
Oct 10, 2022, 8:40:11 AM10/10/22
to numbas...@googlegroups.com
Thanks for spotting this! I think that this must have been due to a change in how the variable scope used to evaluate variables is created.
I've fixed the problem.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/5a129840-3bcb-4d6d-9f37-0f890fc96a07n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages