+ Start a Discussion

Need help with a NullPointer Exception

I am gettinga null pointer exception on this line. I ran system.asserts to make sure that both of them were returning values, and both of them are. So, does anybody know why I would be getting null pointer exception when I compare them?



if(olWSmallestDate.ServiceDate.month() < System.today().month()) {...




By "Both of them" do you mean you are asserting that both "olWSmallestDate" and "ServiceDate" are non-null?

OOOPS! Dumb question. I just figured it out. The logic i was using to populate the variable was a little off. I got that bit working now. However, I may post to this board again, if you're interested, because this could lead to other questions and I know that what I am doing could be done a lot more efficiently.