Avoid null pointer exception when comparing annotations
Change-Id: Iedcd138fb6cbc5be6bdf79890e872d1d4a9ccc82
Showing
1 changed file
with
5 additions
and
1 deletions
| ... | @@ -33,7 +33,11 @@ public final class AnnotationsUtil { | ... | @@ -33,7 +33,11 @@ public final class AnnotationsUtil { |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | for (String key : lhs.keys()) { | 35 | for (String key : lhs.keys()) { |
| 36 | - if (!lhs.value(key).equals(rhs.value(key))) { | 36 | + if (lhs.value(key) == null && rhs.value(key) != null) { |
| 37 | + return false; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + if (lhs.value(key) != null && !lhs.value(key).equals(rhs.value(key))) { | ||
| 37 | return false; | 41 | return false; |
| 38 | } | 42 | } |
| 39 | } | 43 | } | ... | ... |
-
Please register or login to post a comment