View Full Version : Null error when passing parameters between methods

03-31-2012, 07:45 PM
Hi all! I am working on a program that is from the "Learning to Program with Alice" textbook. I and several of my classmates have come across an error in a particular program. In the program there are several world methods that are called to have Zeus zap an object that is clicked with the mouse. The program passes the target between methods to perform the zap. Once and item is clicked however, I get an error "Alice has detected a problem with your world: target value must not be null" If I change the code to only work when one named target is clicked I get the attached error code. I have included the world for reference. I am using Alice 2.2 for Windows with the textbook.

04-02-2012, 12:03 AM
Heh, we had the same issue in our class.

04-02-2012, 04:36 PM
I'm also having this exact issue. So frustrating! I can't tell if it's Alice or my own poor coding. Please let me know if you find a solution.

04-02-2012, 04:41 PM
pretty sure its Alice. its a really stupid program

04-02-2012, 04:47 PM
I saw in the troubleshooting thread that this is a known bug in Alice 2.2 and should be fixed in the update of 3/1/12 - I'm going to try downloading again.

04-02-2012, 05:00 PM
There's a relatively simple workaround.

Just make a new variable of the same data type as the parameter being passed (local and global variables work), set the variable's value to the parameter, then use the variable as the value for the parameter of the method call.

Here's the fixed world implementing this.

04-02-2012, 05:11 PM
I downloaded the updated version of Alice 2.2 and everything works fine now.

04-02-2012, 05:48 PM
Thanks everyone for all the feedback. :) I am going to try the March 1 2012 version. I will report back if that fixes the issue for me as well.