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) {
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(
Meeting.USER_SERVICE.getRealName(participant), '-'));
for (final IndividualTopic topic : this.individualTopics) {
buffer.append("\n");
buffer.append(getTopic(topic));
buffer.append("\n");
for (final Message message : topic.getMessages(participant)) {
buffer.append("* " + message.getContent() + "\n");
if (topic.hasParticipant(participant)) {
buffer.append("\n");
buffer.append(getTopic(topic));
buffer.append("\n");
for (final Message message : topic
.getMessages(participant)) {
buffer.append("* " + message.getContent() + "\n");
}
}
}
}