Skip to content

Commit

Permalink
Fix NullPointerException in Annotations#iterator
Browse files Browse the repository at this point in the history
If the annotations `Map` hasn't yet been initialized, initialize it
instead of throwing an NPE.
  • Loading branch information
nicktelford committed Jan 13, 2014
1 parent c6925f1 commit d1163cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/fasterxml/classmate/Annotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public void addAsDefault(Annotation defValue)

public Iterator<Annotation> iterator()
{
if (_annotations == null) {
_annotations = new HashMap<Class<? extends Annotation>,Annotation>();
}
return _annotations.values().iterator();
}

Expand Down

0 comments on commit d1163cf

Please sign in to comment.