Fix NPE if a participant hasn't message in an individual topic

This commit is contained in:
Nicolas VINOT 2011-09-05 10:41:12 +02:00
parent e6f67154d1
commit 3bb095bef8
2 changed files with 12 additions and 5 deletions

View file

@ -31,4 +31,8 @@ public class IndividualTopic extends Topic {
public List<Message> getMessages(final String author) { public List<Message> getMessages(final String author) {
return this.messages.get(author); return this.messages.get(author);
} }
public boolean hasParticipant(final String participant) {
return this.messages.containsKey(participant);
}
} }

View file

@ -56,11 +56,14 @@ public class Meeting {
buffer.append(getLine( buffer.append(getLine(
Meeting.USER_SERVICE.getRealName(participant), '-')); Meeting.USER_SERVICE.getRealName(participant), '-'));
for (final IndividualTopic topic : this.individualTopics) { for (final IndividualTopic topic : this.individualTopics) {
buffer.append("\n"); if (topic.hasParticipant(participant)) {
buffer.append(getTopic(topic)); buffer.append("\n");
buffer.append("\n"); buffer.append(getTopic(topic));
for (final Message message : topic.getMessages(participant)) { buffer.append("\n");
buffer.append("* " + message.getContent() + "\n"); for (final Message message : topic
.getMessages(participant)) {
buffer.append("* " + message.getContent() + "\n");
}
} }
} }
} }