mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +01:00
Fixed NPE when muc#roominfo_subject has no value. SMACK-163
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4775 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
8879234bbc
commit
a9c3ffe64c
1 changed files with 9 additions and 1 deletions
|
@ -23,6 +23,8 @@ package org.jivesoftware.smackx.muc;
|
|||
import org.jivesoftware.smackx.Form;
|
||||
import org.jivesoftware.smackx.packet.DiscoverInfo;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Represents the room information that was discovered using Service Discovery. It's possible to
|
||||
* obtain information about a room before joining the room but only for rooms that are public (i.e.
|
||||
|
@ -88,7 +90,13 @@ public class RoomInfo {
|
|||
if (form != null) {
|
||||
this.description =
|
||||
form.getField("muc#roominfo_description").getValues().next();
|
||||
this.subject = form.getField("muc#roominfo_subject").getValues().next();
|
||||
Iterator<String> values = form.getField("muc#roominfo_subject").getValues();
|
||||
if (values.hasNext()) {
|
||||
this.subject = values.next();
|
||||
}
|
||||
else {
|
||||
this.subject = "";
|
||||
}
|
||||
this.occupantsCount =
|
||||
Integer.parseInt(form.getField("muc#roominfo_occupants").getValues()
|
||||
.next());
|
||||
|
|
Loading…
Reference in a new issue