#178 - Fixed potential NullPointerException in ResourceSupport.
ResourceSupport now has a null guard in equals(…) to prevent NullPointerExceptions from happening.
This commit is contained in:
@@ -142,7 +142,7 @@ public class ResourceSupport implements Identifiable<Link> {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!obj.getClass().equals(this.getClass())) {
|
||||
if (obj == null || !obj.getClass().equals(this.getClass())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,4 +133,14 @@ public class ResourceSupportUnitTest {
|
||||
|
||||
TestUtils.assertNotEqualAndDifferentHashCode(left, right);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #178
|
||||
*/
|
||||
@Test
|
||||
public void doesNotEqualNull() {
|
||||
|
||||
ResourceSupport support = new ResourceSupport();
|
||||
assertThat(support.equals(null), is(false));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user