diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-12-14 18:10:46 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-12-14 18:10:46 +0100 |
commit | de06cb38d190e9853e8557e07eaff1c8ba881e2a (patch) | |
tree | b21889f1166bde268cdc60d073664dc121e79b12 /src/main/java/eu/siacs/conversations/entities/Message.java | |
parent | fc293aaede58028c73ab7f69f07c991797442f07 (diff) |
refactored the way certain messages are being found within a conversation
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Message.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index c7a92d848..5b9371386 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -323,12 +323,10 @@ public class Message extends AbstractEntity { synchronized (this.conversation.messages) { if (this.mNextMessage == null) { int index = this.conversation.messages.indexOf(this); - if (index < 0 - || index >= this.conversation.getMessages().size() - 1) { + if (index < 0 || index >= this.conversation.messages.size() - 1) { this.mNextMessage = null; } else { - this.mNextMessage = this.conversation.messages - .get(index + 1); + this.mNextMessage = this.conversation.messages.get(index + 1); } } return this.mNextMessage; @@ -338,13 +336,11 @@ public class Message extends AbstractEntity { public Message prev() { synchronized (this.conversation.messages) { if (this.mPreviousMessage == null) { - int index = this.conversation.messages.indexOf(this); if (index <= 0 || index > this.conversation.messages.size()) { this.mPreviousMessage = null; } else { - this.mPreviousMessage = this.conversation.messages - .get(index - 1); + this.mPreviousMessage = this.conversation.messages.get(index - 1); } } return this.mPreviousMessage; |