1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-27 14:47:59 +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:
Gaston Dombiak 2006-08-02 22:32:45 +00:00 committed by gato
parent 8879234bbc
commit a9c3ffe64c

View file

@ -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());