'null' slot don't work in set_pinv()
LadyCailinBot opened this issue · 7 comments
CMDHELPER-2990 - Reported by Алексей.Положенцев
Isn't is supposed to change item in player's hand?
/setinv = set_pinv(player(), array(null: null)) // do nothing
/setinv2 = set_pinv(player(), array(1: null)) // works fine
Using build from https://www.dropbox.com/s/k944hgevixmcsg5/commandhelper-3.3.1-SNAPSHOT.jar?dl=0
Comment by VergilPrime
As a work around you can get the player's hand slot using pinfo()
Comment by PseudoKnight
I don't know what build that is, so I tested a couple. I can't reproduce this issue on 2784, but I can reproduce it on 2798. If you must use 2798, you can work around this issue by quoting 'null' index, which will continue to work even after this is fixed. eg. set_pinv(player(), array('null': null))
Comment by Алексей.Положенцев
@PseudoKnight Yes, it's the newest build. Thanks for workaround!
Comment by PseudoKnight
For some reason it's defining the index as string 'null' when unquoted, but null when quoted.
I'm fairly certain it has to do with this commit:
eb35476
Though I have yet to test without it, my best guess is the autoconcat change screwed this up. However, it appears this is the only function to experience a problem due to it.
Comment by PseudoKnight
I found another situation that this affects.
switch(@var) {
case 'null':
msg('Expected result.');
default:
msg('Actual result.');
}
switch(@var) {
case null:
msg('Actual result.');
default:
msg('Expected result.');
}```
Comment by Pieter12345
In PseudoKnight's example, if you try to do case null: ... case 'null': ..., it will throw a compile error (it contains 2 cases with the same value). This check thinks that 'null' = null.. this does match the bug shown in the example above.