Fixed crash if non-text message is received while ChatFragment is open.
This commit is contained in:
parent
fb3592c2ae
commit
f040bb4032
1 changed files with 7 additions and 2 deletions
|
@ -111,8 +111,13 @@ class ChatFragment extends ListFragment with OnClickListener
|
|||
* Displays new messages in UI.
|
||||
*/
|
||||
override def onMessageReceived(msg: Message): Unit = {
|
||||
if (Set(msg.Header.origin, msg.Header.target).contains(address))
|
||||
adapter.add(msg)
|
||||
if (!Set(msg.Header.origin, msg.Header.target).contains(address))
|
||||
return
|
||||
|
||||
msg.Body match {
|
||||
case _: Text => adapter.add(msg)
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue