Since nobody has said it yet, Welcome to JavaRanch!
It looks like you're having a little bit of confusion concerning what can be done with a
null value. As your code demonstrates (by its failure), you can't
test an object for equality using the
equals(Object) method if the object is
null - note the argument to the method can be
null, not the object invoking the method.
For your purposes, a quick and easy solution would be to reverse the order of your tests in your if statement. That way, if the component has a
null value, then the second test for equality wouldn't be performed on a
null value (as the test would short circuit).
Here's some quick example code to consider:
Making sense?
Good Luck.