As shown in the above two pictures, I passed in a decidedDistribute from the front desk. From the output, it can be seen that the decidedDistribute has a value passed in, and the value is still correct when the if statement is judged, but I don’t know why the if function is entered. After the field is entered, it becomes a null pointer, null is output, and a null pointer exception is reported in subsequent calls.
Please explain, thank you
You see the error message and it has already jumped to the Distribute2 method. Why do you still post the content of the Distribute3 method?
Call DEBUG to track it
You add null when judging if, as follows:
You try it
I agree with Xiao Yang vita’s answer. You have found the place where the wrong code reported the error.
In your eclipse or other IDE, set the number of lines of code to display, otherwise you won’t even know where the error code is.
In addition, the stack has printed out which line of which class has the error. You can click on the link to directly Jump to the error reporting location
Found the problem, this is a web project, the second time the null output is actually loaded after the first load and redirection, and the second time no value is passed in, resulting in an error, so the first time the output is successful , I made an oversight and made a mistake. I’m sorry for wasting everyone’s time. Thank you for your help